# Neovim Keymaps **Leader key = `Space`** --- ## File & Buffer | Key | What it does | |-----|-------------| | `w` | Save the current file | | `q` | Quit Neovim | | `c` | Close the current buffer | | `bc` | Save all buffers, then close everything except the current one | --- ## Navigation | Key | What it does | |-----|-------------| | `e` | Jump to end of line | | `s` | Jump to first non-blank character of line | | `cb` | Go back to previous location (like browser back) | | `cf` | Go forward (undo a `cb`) | --- ## Windows & Splits | Key | What it does | |-----|-------------| | `v` | Open a vertical split | | `h` | Open a horizontal split | | `Ctrl+h` | Move focus to the left window | | `Ctrl+j` | Move focus to the window below | | `Ctrl+k` | Move focus to the window above | | `Ctrl+l` | Move focus to the right window | | `Ctrl+Up` | Make current window shorter | | `Ctrl+Down` | Make current window taller | | `Ctrl+Left` | Make current window narrower | | `Ctrl+Right` | Make current window wider | --- ## File Tree (NERDTree) | Key | What it does | |-----|-------------| | `n` | Show/hide the file explorer sidebar | --- ## Fuzzy Finder (Telescope) | Key | What it does | |-----|-------------| | `ff` | Search for files by name | | `fg` | Search for text inside files (live grep) | | `fb` | List all open buffers | | `fh` | Search Neovim help topics | **Inside a Telescope window:** | Key | What it does | |-----|-------------| | `Ctrl+n` | Move to next result | | `Ctrl+p` | Move to previous result | | `Ctrl+d` | Delete the selected buffer | | `Ctrl+c` | Close Telescope | --- ## Clipboard | Key | What it does | |-----|-------------| | `y` (visual) | Copy selected text to system clipboard | | `p` | Paste from system clipboard | --- ## Search | Key | What it does | |-----|-------------| | `/` | Clear the search highlight | --- ## LSP (Code Intelligence) | Key | What it does | |-----|-------------| | `gd` | Go to the definition of the symbol under cursor | | `K` | Show documentation for the symbol under cursor | | `rn` | Rename the symbol under cursor across the project | | `gr` | Show all references to the symbol (opens in Trouble panel) | | `f` | Format the current file using the LSP | | `a` | Show code actions (quick fixes, refactors) | | `d` | Show hover documentation (same as `K`) | --- ## Comments (Comment.nvim) | Key | What it does | |-----|-------------| | `kk` | Toggle comment on the current line | | `k` + motion | Comment/uncomment everything the motion covers (e.g. `k3j` comments 3 lines down) | | `k` (visual) | Comment/uncomment the selected lines | | `bb` | Toggle block comment on the current line | | `b` + motion | Block comment everything the motion covers | | `b` (visual) | Block comment the selection | --- ## Diagnostics Panel (Trouble.nvim) Shows all LSP errors and warnings — across every file the language server knows about, like the Problems panel in VSCode. | Key | What it does | |-----|-------------| | `xx` | Toggle workspace diagnostics (all errors across the project) | | `xd` | Toggle diagnostics for the current file only | | `xq` | Open the quickfix list in Trouble | | `xl` | Open the location list in Trouble | **Inside the Trouble panel:** | Key | What it does | |-----|-------------| | `j` / `k` | Move to next / previous item | | `Enter` or `Tab` | Jump to that error in the file | | `x` | Open the file in a horizontal split | | `v` | Open the file in a vertical split | | `p` | Preview the error location without leaving Trouble | | `r` | Refresh the list | | `za` | Toggle fold for a file group | | `zm` | Collapse all file groups | | `zr` | Expand all file groups | | `q` | Close the Trouble panel | --- ## Terminal | Key | What it does | |-----|-------------| | `t` | Open/close the terminal (toggles a split at the bottom) | | `t` (inside terminal) | Close the terminal | --- ## Testing (vim-test) | Key | What it does | |-----|-------------| | `tn` | Run the test nearest to the cursor | | `tf` | Run all tests in the current file | | `ts` | Run the entire test suite | | `tl` | Re-run the last test that was run | | `tv` | Open the test file that was last run | --- ## Markdown Preview | Key | What it does | |-----|-------------| | `mp` | Open a browser preview of the current Markdown file | | `ms` | Stop the Markdown preview | | `mf` | Keep the preview scrolled to where your cursor is | | `mt` | Toggle the Markdown preview on/off | --- ## Utilities | Key | What it does | |-----|-------------| | `sr` | Search and replace (interactive prompt) | | `cf` | Create a new Java file |