Keymap Reference
mapleaderis<Space>.maplocalleaderis\.- Mode notation:
n(normal),i(insert),v(visual),x(visual selection),o(operator-pending),t(terminal),c(command). When multiple modes are listed, the mapping is active in each of them.
Navigation and Editing
n<Esc>- Clear the last search highlight via:nohlsearch.ijj- Exit insert mode.
Window and Buffer Management
n<Tab>- Switch to the next buffer (:bnext).n<S-Tab>- Switch to the previous buffer (:bprevious).n,i,v,t,c<C-h>- Focus the split to the left.n,i,v,t,c<C-j>- Focus the split below.n,i,v,t,c<C-k>- Focus the split above.n,i,v,t,c<C-l>- Focus the split to the right.n<leader>q- Smart close the current view or delete the buffer (Mini Bufremove checks for unsaved changes).
Terminal
tjj- Leave terminal mode (<C-\><C-n>); automatically disabled insideyaziterminals.t<Esc><Esc>- Leave terminal mode (<C-\><C-n>).
Formatting
n<leader>f- Format the current buffer asynchronously via Conform (falls back to LSP when needed).
LSP (buffer-local)
Mappings are attached to an LSP-enabled buffer when the server connects.
ngrn- Rename the symbol under the cursor.n,xgra- Trigger code actions for the cursor or selection.ngrr- List references with Telescope.ngri- List implementations with Telescope.ngrd- Jump to definitions with Telescope.ngrD- Jump to declarations.ngO- Open document symbols in Telescope.ngW- Open workspace symbols in Telescope.ngrt- Show type definitions in Telescope.n<leader>th- Toggle inlay hints when the server supports them.
Git (gitsigns, buffer-local)
n]c- Jump to the next git hunk (respects diff mode).n[c- Jump to the previous git hunk.v<leader>hs- Stage the selected lines.v<leader>hr- Reset the selected lines.n<leader>hs- Stage the current hunk.n<leader>hr- Reset the current hunk.n<leader>hS- Stage the entire buffer.n<leader>hu- Undo the last stage action for the hunk.n<leader>hR- Reset the entire buffer.n<leader>hp- Preview the current hunk.n<leader>hb- Show blame information for the current line.n<leader>hd- Diff against the index.n<leader>hD- Diff againstHEAD.n<leader>tb- Toggle inline blame.n<leader>tD- Toggle inline deleted line preview.
Snacks Pickers and Search
n<leader><space>- Smart picker for files and buffers.n<leader>,- Buffer picker.n<leader>/- Live grep across the project.n<leader>:- Command history picker.n<leader>n- Notification history.n<leader>e- Snacks file explorer.n<leader>fc- Find files under the Neovim config directory.n<leader>fg- Find git-tracked files.n<leader>fp- Project selector.n<leader>fr- Recently opened files.n<leader>sb- Search lines in the current buffer.n<leader>sB- Grep across open buffers.n,x<leader>sw- Grep the current word or selection.n<leader>s"- Inspect registers.n<leader>s/- Search history picker.n<leader>sa- Autocommands browser.n<leader>sC- Commands browser.n<leader>sd- Diagnostics across the project.n<leader>sD- Diagnostics for the current buffer.n<leader>sh- Help tags.n<leader>sH- Highlight groups.n<leader>si- Icon browser.n<leader>sj- Jump list.n<leader>sk- Keymaps browser.n<leader>sl- Location list items.n<leader>sm- Marks.n<leader>sM- Man pages.n<leader>sp- Lazy plugin specs.n<leader>sq- Quickfix list.n<leader>sR- Resume the last picker.n<leader>su- Undo history.n<leader>ss- LSP document symbols.n<leader>sS- LSP workspace symbols.n<leader>uC- Color scheme picker.
Snacks Utilities and Tools
ngd- Go to definition via Snacks picker.ngD- Go to declaration via Snacks picker.ngr- Go to references via Snacks picker.ngI- Go to implementations via Snacks picker.ngy- Go to type definitions via Snacks picker.n<leader>z- Toggle zen mode.n<leader>Z- Toggle zoomed-in view.n<leader>.- Toggle scratch buffer.n<leader>S- Select a scratch buffer.n<leader>bd- Delete the current buffer.n<leader>cR- Rename the current file.n,v<leader>gB- Open the current location in the browser.n<leader>gg- Launch Lazygit.n<leader>un- Dismiss all notifications.n<C-/>- Toggle the Snacks terminal.n<C-_>- Toggle the Snacks terminal (alias).n,t]]- Jump to the next reference highlight.n,t[[- Jump to the previous reference highlight.
Snacks Toggles
n<leader>us- Toggle spell checking.n<leader>uw- Togglewrap.n<leader>uL- Toggle relative line numbers.n<leader>ud- Toggle diagnostics visibility.n<leader>ul- Toggle absolute line numbers.n<leader>uc- Toggleconceallevel.n<leader>uT- Toggle Treesitter highlighting.n<leader>ub- Toggle between light and dark backgrounds.n<leader>uh- Toggle LSP inlay hints.n<leader>ug- Toggle indent guides.n<leader>uD- Toggle dimming overlay.
Aerial (outline)
n<leader>o- Toggle the Aerial outline window.n{- Jump to the previous symbol (buffer-local while Aerial is attached).n}- Jump to the next symbol (buffer-local while Aerial is attached).
Folding (nvim-ufo)
nzR- Open all folds.nzM- Close all folds.nK- Peek folded lines; falls back tovim.lsp.buf.hover()when no fold is under the cursor.
File Manager (yazi.nvim)
n,v<leader>-- Launch Yazi at the current file.n<leader>cw- Launch Yazi in the current working directory.n<C-Up>- Toggle or resume the last Yazi session.
Claude Code
(Group)<leader>a- Which-key anchor for AI and Claude commands.n<leader>ac- Toggle the Claude panel.n<leader>af- Focus the Claude panel window.n<leader>ar- Resume the last Claude session.n<leader>aC- Continue the current Claude conversation.n<leader>am- Choose the Claude model.n<leader>ab- Add the current buffer to Claude context.v<leader>as- Send the visual selection to Claude.n<leader>as- Add the highlighted item to Claude from file or tree buffers.n<leader>aa- Accept Claude diff changes.n<leader>ad- Reject Claude diff changes.
CodeCompanion
Chat buffer workflow
- Toggle persistent chat:
<leader>ca或<localleader>a. - Open a new chat with the active adapter:
<leader>cn或:CodeCompanionChat. - Feed code into the current chat from Visual mode: select text and hit
ga或<leader>cB. - Refresh conditional context (memory, variables, slash commands):
<leader>cR.
Inline assistant
- Invoke inline edits on selections or the current buffer:
<leader>cc(works in Normal/Visual) 或:CodeCompanion <prompt>. - Use slash commands (
/fix,/tests,/explain, etc.) or variables (#{buffer},#{selection}) in prompts for richer context.
Action palette / commands
- Global palette of prompts, tools, workflows:
<C-a>(Normal/Visual) 或<leader>cA. - Abbreviation:
ccin command-line automatically expands toCodeCompanion, so:cc /explainruns the/explainprompt. - Core commands:
:CodeCompanion– inline assistant; accepts adapter override or prompt library entry (e.g.,:CodeCompanion /commit).:CodeCompanionChat– opens chat; supportsToggle,Add,RefreshCache, adapter selection, and inline prompts.:CodeCompanionCmd– asks the assistant to build Neovim commands (great for quick macros).:CodeCompanionActions– same as<C-a>but from command-line.
Context/memory
- Drop
AGENT/AGENTS/CLAUDE/avanteinstruction files (or.cursor/rules/*.md) in your repo or$XDG_CONFIG_HOME/nvim; they’re auto-detected and added to chats when they exist. - Chats skip memory if the adapter is ACP-based (per upstream recommendation), so standard Copilot/GitHub/Anthropic chats always load default memory.
Adapters & models
- All strategies default to Copilot’s
gpt-4o-mini. To target a different model temporarily, run:CodeCompanion <adapter> <prompt>(e.g.,:CodeCompanion anthropic What is this file doing?).
Quality-of-life tips
- Run
:CodeCompanionChat Addwhile in Visual mode to capture selections without thegamapping if you prefer commands. - Use slash commands in chat (
/buffer,/file,/grep,/help) with native completion (<C-_>in insert mode) for structured context injection. - Variables (
#{buffer},#{clipboard}, etc.) and tools (@{grep_search}) follow the docs’ syntax; include them directly in your prompt text.
Molten (notebook runner)
Global:
n<localleader>mi- Initialize Molten in the current buffer.
Buffer-local (after :MoltenInit):
n<localleader>mi- Re-runMoltenInit.n<localleader>md- Deinitialize Molten.n<localleader>me- Evaluate the current line.v<localleader>me- Evaluate the visual selection.n<localleader>mr- Reevaluate the active cell.n<localleader>mx- Delete the active cell.n<localleader>mo- Enter the output window without triggering autocommands.n<localleader>mh- Hide the output window.
Grug-Far
n,v<localleader>sw- Open Grug-Far scoped to the workspace (current working directory).n,v<localleader>sb- Open Grug-Far across all listed buffers.n,v<localleader>sf- Open Grug-Far scoped to the current file.
CSV View
o,xif- Select the inner CSV field text object.o,xaf- Select the outer CSV field text object.
Leap Motions
n,x,os- Leap forward to a target.n,x,oS- Leap backward to a target.n,x,ogs- Leap from another window.
Noice
n<C-n>- Scroll forward inside Noice LSP documentation (falls back to<C-f>when unavailable).n<C-p>- Scroll backward inside Noice LSP documentation (falls back to<C-b>when unavailable).n<leader>K- Open LSP hover text in a vertical split.nq- Close the custom hover buffer (buffer-local to the hover split created by<leader>K).
Additional Notes
- The terminal mapping
jjis automatically disabled insideyaziterminal buffers so the file manager keeps its native navigation. - Many plugin mappings (for example gitsigns, LSP, Aerial, Molten, Noice hover, Avante, CSV View) are buffer-local and only active while the corresponding plugin attaches.