How do I jump between method or function definitions in Vim?
]m / [m
Vim's ]m and [m motions navigate between method and function boundaries in curly-brace languages like C, Java, JavaScript, and Go.
]m / [m
Vim's ]m and [m motions navigate between method and function boundaries in curly-brace languages like C, Java, JavaScript, and Go.
<C-w>^
Vim tracks the alternate buffer — the last file you were editing before the current one.
* (in visual mode)
In normal mode, searches for the word under the cursor with word-boundary anchors.
o (visual mode)
In visual mode, pressing o swaps the cursor between the two ends of the selection (the anchor and the free end).
'[ and ']
Vim automatically sets two marks whenever you yank, change, delete, or paste text: ` [ ` (backtick-bracket) marks the start of the affected region, and ] ` mark
:set iskeyword+=-
By default, Vim treats hyphens, dots, and many punctuation characters as word boundaries.
:set matchpairs+=<:>
By default, the % command jumps between (), {}, and [] pairs.
config #navigation #config #matchpairs #editing #normal-mode
:set suffixesadd+=.js,.ts,.jsx,.tsx
The gf (go to file) command opens the file under the cursor, but it fails when the path lacks an extension — common in JavaScript/TypeScript imports like impo
navigation #navigation #config #editing #buffers #file-management
:set scrolloff=999
By default, Vim only scrolls the viewport when the cursor reaches the very top or bottom of the screen.
navigation #navigation #scrolling #config #cursor #scrolloff
:vimgrep /pattern/ **/*
While external tools like grep or ripgrep are fast, Vim's built-in :vimgrep has a key advantage: it populates the quickfix list directly, so you can jump betwee
<C-o>zz
When you are typing in insert mode and the cursor drifts near the top or bottom of the screen, you normally have to press , then zz, then i or a to continue edi
:let view=winsaveview() | {cmd} | call winrestview(view)
When writing Vimscript functions or mappings, commands like :substitute, gg, or :%normal will move the cursor and change the scroll position.
:nnoremap <expr> j (v:count == 0 ? 'gj' : 'j')
Expression mappings use the flag to evaluate a Vimscript expression at the time the key is pressed.
grn / grc / grm
Neovim's nvim-treesitter plugin provides incremental selection based on the abstract syntax tree (AST) of your code.
:tab drop filename
When working with many tabs, you often want to open a file — but only if it is not already open somewhere.
/\%>10c\%<20cpattern
When working with columnar data like CSV files, log files, or fixed-width records, you often need to match a pattern only when it appears in a specific column r
:diffthis
You often have two files open side by side and want to compare them without leaving Vim or launching vimdiff.
:tag /pattern
When working with ctags, you typically jump to exact tag names with .
:g/pattern/z#.5
The :global command is great for finding lines matching a pattern, but by default it only shows the matching lines themselves.
v_o
When you start a visual selection, the cursor is at one end and the anchor is at the other.