Skip to main content

⌨️ Keymaps

FtVim comes with a comprehensive set of keymaps designed for efficient editing. The leader key is <Space> by default.

tip

Press <leader> (Space) and wait to see all available keymaps via which-key. <leader>Fk searches every keymap, and :help ftvim-keymaps.txt shows the full list inside Neovim.

General​

KeymapModeDescription
<C-s>Normal/Insert/VisualSave file
<Esc>Normal/InsertClear search highlight
jkInsertExit insert mode (alternative to Esc)
j / kNormal/VisualMove by display line when no count is given
<leader>KNormalKeywordprg (K without LSP)
<leader>qqNormalQuit
<leader>;NormalDashboard

The arrow keys are disabled in normal mode and show a reminder to use h, j, k, l.

Window Navigation​

KeymapModeDescription
<C-h>Normal/TerminalGo to left window
<C-j>Normal/TerminalGo to lower window
<C-k>Normal/TerminalGo to upper window
<C-l>Normal/TerminalGo to right window

Window Resize​

KeymapDescription
<C-Up>Increase window height
<C-Down>Decrease window height
<C-Left>Decrease window width
<C-Right>Increase window width

Move Lines​

KeymapModeDescription
<A-j>Normal/Insert/VisualMove line(s) down
<A-k>Normal/Insert/VisualMove line(s) up

Indenting​

KeymapModeDescription
<VisualIndent left (stays in visual mode)
>VisualIndent right (stays in visual mode)

Comments​

FtVim uses Neovim's built-in commenting.

KeymapModeDescription
gccNormalToggle comment on the line
gcNormal/VisualToggle comment (with a motion or selection)
<leader>/Normal/VisualToggle comment
gcoNormalAdd comment below
gcONormalAdd comment above

Find (Leader + f)​

All find commands use the snacks.nvim picker.

KeymapDescription
<leader>ffFind files
<leader>frRecent files
<leader>fbFind buffers
<leader>fsFind string (grep)
<leader>fcFind string under cursor
<leader>fhFind help tags
<leader>fkFind keymaps
<leader>fCFind commands
<leader>fHFind highlights
<leader>fMFind man pages
<leader>fRFind registers
<leader>flResume last search
<leader>fnNew file

Picker Navigation​

When the picker is open:

KeymapDescription
<C-j> / <C-n>Next item
<C-k> / <C-p>Previous item
<CR>Confirm selection
<Esc>Close picker

Buffers (Leader + b)​

KeymapDescription
<S-h> / [bPrevious buffer
<S-l> / ]bNext buffer
[B / ]BMove buffer left/right
<leader>bbPrevious buffer
<leader>bnNext buffer
<leader>bdDelete buffer
<leader>bDDelete buffer (force)
<leader>bfFind buffer
<leader>bjJump to buffer (pick)
<leader>bePick buffer to close
<leader>blDelete buffers to the left
<leader>brDelete buffers to the right
<leader>boDelete other buffers
<leader>bpToggle pin
<leader>bPDelete non-pinned buffers
<leader>bsSort buffers by directory
<leader>bLSort buffers by language
<leader>bWSave without formatting

Code / LSP (Leader + c)​

These keymaps are available when a language server is attached to the buffer:

KeymapDescription
gdGo to definition
grGo to references
gIGo to implementation
gyGo to type definition
gDGo to declaration
KHover documentation
gKSignature help
<leader>caCode action (normal and visual)
<leader>crRename symbol
<leader>cdGo to definition
<leader>ciGo to implementation
<leader>ctGo to type definition
<leader>csSignature help
<leader>cvHover
<leader>chToggle inlay hints (if the server supports them)

Always available:

KeymapDescription
<leader>cfFormat buffer or selection
<leader>cmOpen Mason
]] / [[Next/previous reference of the word under cursor

Completion​

KeymapDescription
<C-Space>Show completion / toggle documentation
<CR> / <C-y>Accept
<C-e>Close the menu
<Tab> / <C-j> / <C-n>Next item (<Tab> also jumps to the next snippet field)
<S-Tab> / <C-k> / <C-p>Previous item
<C-f> / <C-b>Scroll documentation

Git (Leader + g)​

KeymapDescription
<leader>gbGit branches
<leader>gcGit commits
<leader>gCGit buffer commits
<leader>goGit status
]h / [hNext/previous hunk
]H / [HLast/first hunk
<leader>ghsStage hunk
<leader>ghrReset hunk
<leader>ghSStage buffer
<leader>ghuUndo stage hunk
<leader>ghRReset buffer
<leader>ghpPreview hunk inline
<leader>ghbBlame line
<leader>ghBBlame buffer
<leader>ghdDiff this
<leader>ghDDiff this ~
ihSelect hunk (text object)

Windows (Leader + w)​

KeymapDescription
<leader>wdClose window
<leader>wwNew window
<leader>wshSplit horizontal
<leader>wsvSplit vertical

Tabs (Leader + Tab)​

KeymapDescription
<leader><tab><tab>New tab
<leader><tab>dClose tab
<leader><tab>]Next tab
<leader><tab>[Previous tab
<leader><tab>lLast tab
<leader><tab>fFirst tab
<leader><tab>oClose other tabs

Terminal (Leader + t)​

KeymapModeDescription
<C-\>Normal/TerminalToggle floating terminal
<leader>tfNormalFloating terminal
<leader>thNormalHorizontal terminal
<leader>tvNormalVertical terminal

Each one is a separate terminal that keeps running while hidden. In terminal mode, use <C-h/j/k/l> to go to other windows.

Explorer​

KeymapDescription
<leader>eToggle file explorer (Neo-tree)

In Neo-tree:

KeymapDescription
lOpen file/expand folder
hClose folder
<Space>None (disabled to preserve leader)

Diagnostics (Leader + x)​

KeymapDescription
<leader>xdToggle diagnostics on/off
<leader>xlLocation list
<leader>xqQuickfix list
[qPrevious quickfix item
]qNext quickfix item

UI and Notifications (Leader + u, Leader + n)​

KeymapDescription
<leader>ufToggle format on save
<leader>unDismiss all notifications
<leader>nhNotification history

Plugins (Leader + p)​

KeymapDescription
<leader>lOpen Lazy (plugin manager)
<leader>plOpen Lazy
<leader>piInstall plugins
<leader>puUpdate plugins
<leader>psSync plugins
<leader>pSClear unused plugins

Text Objects​

KeymapDescription
af / ifAround/inside function
ac / icAround/inside class
ao / ioAround/inside block, conditional or loop
aa / iaAround/inside argument

See Treesitter for more.

FtVim (Leader + F)​

KeymapDescription
<leader>FkView all keymaps
<leader>FxEnable/disable extras
<leader>FHHealth check (:checkhealth ftvim)

With the 42 Extra​

KeymapDescription
<leader>FhInsert 42 header
<leader>FnNorminette on the project
<leader>FeToggle exam mode
<leader>FCCheck project before submitting
<leader>FmMake
<leader>FvValgrind
<leader>FgGenerate compile_commands.json
<leader>FfFormat C code (42 norm)
<leader>FcCount lines (42)

See the 42 extra for details.

Debug (Leader + d)​

With the Debugging extra (included in the 42 extra):

KeymapDescription
<F5> / <leader>dcRun / Continue
<leader>dbToggle breakpoint
<leader>dBConditional breakpoint
<leader>dCRun to cursor
<leader>do / <leader>di / <leader>dOStep over / into / out
<leader>dlRun last
<leader>drToggle REPL
<leader>dtTerminate
<leader>duToggle debugger UI
<leader>deEvaluate expression

Treesitter (Leader + T)​

KeymapDescription
<leader>TiTreesitter info