After using LazyVim for a while, you will realize most keybindings never get used. Here’s what actually matters.
Navigation
Jumping around:
*/#- search word under cursor forward/backward<C-o>/<C-i>- jump backward/forward in history (lifesaver when combined withgg/gd){/}- jump by paragraph(/)- jump by sentence%- jump between matching brackets<C-^>- toggle between last two files
Keep your cursor centered while scrolling (<C-d>, <C-u>, n, N) and
jumping through search results (n, N) to avoid losing context:
-- `~/.config/nvim/lua/config/keymaps.lua`vim.keymap.set("n", "<C-d>", "<C-d>zz", { noremap = true })vim.keymap.set("n", "<C-u>", "<C-u>zz", { noremap = true })vim.keymap.set("n", "n", "nzzzv", { noremap = true })vim.keymap.set("n", "N", "Nzzzv", { noremap = true })Reposition screen without moving cursor:
zt/zz/zb- cursor to top/middle/bottom
flash.nvim
This plugin changes everything. Press s, type what you want to jump to, hit
enter. Works across splits, multiple lines, whatever’s on screen. If there are
multiple matches, just type the label character.
Same goes for f/F (find) and t/T (to). flash.nvim makes them work
across lines.
Editing
The basics:
.- repeat last actionJ- join linesgi- jump to last insert position and enter insert modege- go to end of previous word<C-a>/<C-x>- increment/decrement number
Block insert is underrated:
<C-v>to enter visual block mode- Select what you want
Iorcto insert/change- Type your text
- Hit
<Esc>twice
Macros when you need them. The second q can be any letter to indicate the
buffer you are recording the macro into:
qqto start recording- Do your thing
qto stop@q/Qto replay
Text objects
The pattern is <verb><context><object>:
- Context:
i(inside) ora(around) - Objects:
wword,ssentence,pparagraph,"'quotes,()[]{}brackets,c/f/oclass/function/block,ttag,iindentation
Examples: diw (delete inside word), ca" (change around quotes), vip
(select inside paragraph)
Special mention for gn: selects next search match. Great for targeted
find-and-replace.
Use S for Treesitter mode. Figuring out what it does is part of the fun. Hint:
practice flash.nvim first.
Search (<Space>s)
<Space>sg/<Space>sG- grep in project/cwd<Space>sk- search keymaps<Space>ss/<Space>sS- search symbols (document/workspace)<Space>st- search todos<Space>sb- search current buffer<Space>sr- search and replace<Space>sR- resume last search<Space>sn- search notification history
Code (<Space>c)
<Space>ca- code actions<Space>cr- rename<Space>cf- format
LSP shortcuts:
gd- go to definitiongr- go to referencesK- hover docs
Jump patterns
The [/] prefix is your friend:
[b/]b- previous/next buffer[d/]d- diagnostic[w/]w- warning[e/]e- error[m/]m- method start[M/]M- method end[q/]q- quickfix/trouble item[t/]t- todo comment[h/]h- git hunk
Miscellaneous
<Space>fc- find config files<Space>g- git/source control<Space>d- debug (withdap.coreextra)<Space>t- test (withtest.coreextra)<Space>a- AI featuresgv- reselect last visual selection. Useful withgvy
Enable ui.treesitter-context to pin current function/class at the top of the
screen.
That’s it. Hope you pick up a few new tricks.
