LazyVim Space-leader Neovim setup

Version Neovim 0.11.2+ · source

Start here

Space
Leader: opens which-key menu
Space Space
Find files
Space /
Grep in project
Space e
File explorer
Space ,
Switch buffer
g d
Go to definition
Space c a
Code action
Space l
Open Lazy plugin manager

Concepts

Neovim the editor, 0.11.2+
lazy.nvim plugin manager
LazyVim preset of plugins and keymaps
Your config lua/plugins/*.lua
Space Space
Find files (project root)
Space /
Grep in project root
Space ,
Switch open buffer
Space :
Command history
Space f r
Recent files
Space f g
Find git-tracked files
Space f c
Find Neovim config file
Space f n
New file
Space f p
Projects
Space s w
Grep word or selection
Space s b
Search lines in buffer
Space s s
Document symbols
Space s S
Workspace symbols
Space s h
Search help pages
Space s k
Search keymaps
Space s C
Search commands
Space s R
Resume last picker
Space s "
Registers
Space s m
Marks
Space s j
Jump list
Space s u
Undo tree
Space s r
Search and replace (grug-far)
Space s t
Todo comments
Space s d
Diagnostics (workspace)
Space S
Pick scratch buffer
Space .
Toggle scratch buffer

Explorer

Space e
Explorer at project root
Space E
Explorer at cwd
Space f m
mini.files at current file (extra)

Buffers & Windows

Shift+H / Shift+L
Previous / next buffer
[ b / ] b
Previous / next buffer
Space b b
Switch to other buffer
Space b d
Delete buffer
Space b o
Delete other buffers
Space b p
Pin buffer
Space b P
Delete non-pinned buffers
Space b j
Pick buffer by letter
Ctrl+H / Ctrl+J / Ctrl+K / Ctrl+L
Move between windows
Ctrl+Arrows
Resize window
Space -
Split below
Space |
Split right
Space w d
Close window
Space w m
Zoom window (toggle)
Space Tab Tab
New tab page
Space Tab ] / Space Tab [
Next / previous tab page

Code & LSP

g d
Go to definition
g r
References
g I
Go to implementation
g y
Go to type definition
g D
Go to declaration
K
Hover docs
g K
Signature help
Space c a
Code action
Space c r
Rename symbol
Space c f
Format file or selection
Space c d
Line diagnostics
] d / [ d
Next / previous diagnostic
] e / [ e
Next / previous error
] w / [ w
Next / previous warning
] ] / [ [
Next / previous reference
Space c R
Rename file
Space c o
Organize imports
Space c A
Source action
Space c l
LSP info
Space c m
Mason (install servers)
Space c s
Symbols outline (Trouble)
Space x x
Workspace diagnostics (Trouble)
Space x X
Buffer diagnostics (Trouble)
Space x q / Space x l
Quickfix / location list
] q / [ q
Next / previous quickfix item
g c c
Toggle line comment
g c o / g c O
Add comment below / above

Motion & Editing

s
Flash: jump to any visible match
S
Flash: select treesitter node
Ctrl+Space
Grow selection by treesitter node
Alt+J / Alt+K
Move line or selection down / up
Ctrl+S
Save file
Esc
Clear search highlight
n / N
Next / previous search match
Space p
Yank history (yanky, extra)
g s a
Add surround (mini.surround)
g s d
Delete surround
g s r
Replace surround

Git

Space g s
Git status
Space g d
Git diff of hunks
Space g b
Blame current line
Space g l
Git log
Space g f
History of current file
Space g g
Open LazyGit
Space g G
Open LazyGit at cwd
Space g B
Open in browser
Space g Y
Copy git link
Space g S
Git stash
Space g p
GitHub pull requests
Space g i
GitHub issues

UI & Toggles

Space u w
Toggle line wrap
Space u l
Toggle line numbers
Space u L
Toggle relative numbers
Space u d
Toggle diagnostics
Space u f
Toggle autoformat (global)
Space u F
Toggle autoformat (buffer)
Space u h
Toggle inlay hints
Space u s
Toggle spell check
Space u C
Pick colorscheme
Space u z
Zen mode
Space n
Notification history
Space u n
Dismiss notifications
Ctrl+/
Toggle terminal
Space f t
Terminal at project root
Space ?
Buffer-local keymaps

Plugins & Sessions

Space l
Lazy plugin manager
Space L
LazyVim changelog
Space q q
Quit all
Space q s
Restore session for cwd
Space q l
Restore last session
:Lazy sync
Install, update, clean plugins
:LazyExtras
Browse and enable extras
:checkhealth lazy
Check plugin manager health
:Mason
Manage LSP servers and tools

Debug & Test (extras)

Space d b
Toggle breakpoint
Space d c
Run or continue
Space t r
Run nearest test
Space t t
Run tests in file
Space d u
Toggle debugger UI

Recipes

Add a plugin (lua/plugins/example.lua)
return {  { "tpope/vim-sleuth" },  { "folke/flash.nvim", opts = {} },}
Own keymap (lua/config/keymaps.lua)
vim.keymap.set("n", "<leader>wq", "<cmd>wqa<cr>",  { desc = "Save all and quit" })
Change an option (lua/config/options.lua)
vim.opt.relativenumber = falsevim.opt.scrolloff = 8
Enable an extra permanently
# lua/config/lazy.lua, in the spec list{ import = "lazyvim.plugins.extras.lang.python" },