4.1 KiB
4.1 KiB
Neovim command and keybind cheat sheet
Some of these are plain Vim commands, others are specific to Neovim.
BASICS
Spaceleader key:checkhealth [<pluginname>]check base or status:verbose set expandtab?check whereexpandtabhas been set last:Lazyshow package manager UI:Lazy restorerevert plugins to the state reflected inlazy-lock.json:Masonshow Mason UI:TSUpdateupdate all treesitter parsers:TSModuleInfoshow installed treesitter parsers:LspInfoshow currently attached LSP client details:ConformInfouseful to debug why a formatter times out
NAVIGATING
Tabs
Ctrl+topen a file in e.g. a Telescope finder in a new tabgtorgTswitch between open tabs (forward/reverse direction)
Windows/splits
Ctrl+wqclose windowCtrl+wssplit window horizontallyCtrl+wvsplit window verticallyCtrl+<h/j/k/l>move between split windowsCtrl+w=equalize split window width and heightCtrl+wrswap position of two windowsCtrl+wTmove active split window to new tab
Buffers
Space+Spaceshows buffers sorted by last used (viaTelescope buffers):bdclose current buffer:bngo to next buffer:bpgo to previous buffer
Code
wmove to start of next word (ignores punctuation due to remap)emove to end of next word (ignores punctuation due to remap)bmove to start of previous word (ignores punctuation due to remap)Ctrl+0start of lineCtrl+$end of lineCtrl+dscroll down 1/2 page while keeping the cursor centeredCtrl+uscroll up 1/2 page while keeping the cursor centeredCtrl+ojump to location you were before (e.g. after usinggg)Ctrl+ijump back to location you were before (after usingCtrl+o)f<char>jump forward to<char>F<char>jump backwards to<char>t<char>jump forward just before<char>T<char>jump backwards just before<char>;jump to next occurence of (same line only),jump to previous occurence of (same line only)
LSP
Ctrl+n/pscroll down/up through LSP suggestionsCtrl+laccept selected suggestiongdgo to definition
Diagnostics
gdgo to definitionleader+qqtoggle trouble.nvim quickfix listleader+dago to next diagnostic (any severity)leader+dwgo to next diagnostic (warning severity)leader+dego to next diagnostic (error severity)
Telescope windows
↓orCtrl+nscroll down (next) file list↑orCtrl+pscroll up (previous) file listCtrl+dscroll down in preview paneCtrl+uscroll up in preview paneCtrl+/helpCtrl+vopen file in vertical splitCtrl+xopen file in horizontal splitCtrl+topen file in new tabCtrl+qsend all items to quickfix listAlt+qsend selected items to quickfix list
EDITING
Code editing
leader+ire-indent whole fileleader+ore-format whole file or visual withconform.nvimiinsert mode at cursor positionIinsert mode at the beginning of the lineainsert mode one character after the current oneAinsert mode at the end of the lineoinsert mode a line below the cursorOinsert mode a line above the cursorsdelete character and replace (substitute) itcwreplace the current wordccreplace whole lineCreplace to the end of the lineyycopy (yank) the current lineppaste yanked line belowPpaste yanked line above"3predo (put) e.g. your third last delete source
Visual mode
vat cursor positionVline modeCtrl+vblock mode
SEARCH/OPEN
leader+fgsearch text in files (also searches for text under cursor)leader+ffsearch files (respects.gitignore)leader+etoggles Oil file explorerleader+forecently opened filesgfopen file under cursor in a new buffergxopen link under cursor in default browser*search marked word