3.9 KiB
3.9 KiB
Neovim command and keybind cheat sheet
BASICS
;leader key:checkhealth [<pluginname>]check base or plugin status:checkhealth vim.lspshow details of LSP attached to buffer:verbose set expandtab?check whereexpandtabhas been set last:Lazyshow package manager UI:Masonshow Mason UI:TSUpdateupdate all Tree-sitter parsers:LspInfoshow attached LSP client details:ConformInfouseful to debug why a formatter times out
NAVIGATING
Windows, splits & tabs
Ctrl+wqclose windowCtrl+wssplit window horizontallyCtrl+wvsplit window verticallyCtrl+h/j/k/lmove between split windowsCtrl+w=equalize split window width and heightCtrl+wrswap position of two windowsCtrl+wTmove active split window to new tabgtorgTswitch forward/reverse between tabs
Buffers
leader+leaderlists open buffers insnipe.nvim- In snipe.nvim popup: Hit
dto close the selected buffer :bdclose current buffer:bn/pgo to next/previous buffer
Text
w/emove to start/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+d/uscroll down/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)s<string>highlight jump targets viaflash.nvim
LSP, Code & Diagnostics
Ctrl+n/pscroll down/up through LSP suggestionsKshow LSP context infoCtrl+laccept selected suggestiongdgo to definitiongrshow references of functiongrnrenames all refs of the symbol under cursorleader+qtoggletrouble.nvimquickfix listleader+dago to next diagnostic (any severity)leader+dwgo to next diagnostic (warning severity)leader+dego to next diagnostic (error severity)
Telescope
↓orCtrl+nscroll down (next) file list↑orCtrl+pscroll up (previous) file listCtrl+d/uscroll down/up in preview paneCtrl+/helpCtrl+vopen file in vertical splitCtrl+xopen file in horizontal splitCtrl+topen file in new tab
Oil
Ctrl+d/ubottom/top of file listCtrl+ppreview fileCtrl+vopen file in vertical splitCtrl+xopen file in horizontal splitCtrl+topen file in new tab
EDITING
Code editing
leader+ore-format whole file or visual w/conform.nvimiinsert mode at cursor positionIinsert mode at beginning of lineainsert mode after the current charAinsert mode at end of lineoinsert mode a line below the cursorOinsert mode a line above the cursorcwreplace the current wordccreplace whole lineCreplace to the end of the lineyycopy the current lineyap"yank-around-paragraph"yip"yank-inside-paragraph"yaWcopy word w/ dashes/underscoresp/Ppaste yanked line below/above:windo diffthisopenvimdifffor open splits:vert diffsplit <other/file>diff this file and<other/file>:windo diffoffto close diff view
SELECTING
Visual mode
vat cursor positionVline modeCtrl+vblock modevap"visual-select-around-paragraph"vip"visual-select-inside-paragraph"
Code selection
Ctrl+leadercontext-sensitive text selection w/ Tree-sitterBackspacereduce context-sensitive selection
SEARCH/OPEN
leader+fgsearch text in files (also searches for text under cursor)leader+ffsearch files (respects.gitignore)leader+etoggle Oil file explorerleader+forecently opened filesgfopen file under cursor in a new buffergxopen link under cursor in default browser*search word under cursor