How do I transform or filter a list inline using Vimscript lambdas with map() and filter()?
map() and filter() with lambdas
Vim 8 introduced lambda expressions with the syntax {args -> expr}, enabling concise inline list transformations.
map() and filter() with lambdas
Vim 8 introduced lambda expressions with the syntax {args -> expr}, enabling concise inline list transformations.
winsaveview() and winrestview()
When writing Vimscript functions or complex mappings that move the cursor, it is essential to restore the original view afterward so the user does not notice an
:earlier 1h
Vim's undo history is annotated with timestamps, allowing you to travel back to any point in time using :earlier and forward using :later.
:Inspect
When customizing a colorscheme or debugging unexpected syntax colors, it's difficult to know which highlight group to override.
cr{s/m/c/k/u}
The vim-abolish plugin provides cr{type} coercions that instantly convert the word under the cursor to a different naming convention.
\V
Vim's default search mode gives special meaning to characters like .
gw{motion}
The gw operator reformats text just like gq, but leaves the cursor exactly where it started.
zm
Instead of jumping between fully open (zR) and fully closed (zM), zm and zr let you step through fold levels one at a time.
qQ
Recording a macro with an uppercase register letter appends to the existing macro in the corresponding lowercase register instead of overwriting it.
:norm! {command}
:normal {command} runs a sequence of Normal mode keystrokes from the command line (or a range of lines with :%normal), but it applies your custom key mappings.
command-line #ex-commands #macros #normal-mode #command-line
1z=
The z= command opens an interactive numbered menu of spelling corrections for the word under the cursor, requiring you to type a number and press Enter.
]c and [c
When files are open in Vim's built-in diff mode — whether via vimdiff, :diffsplit, or :diffthis — the ]c and [c motions let you jump precisely between chang
zR and zM
When working with a heavily folded file, manually opening or closing each fold is tedious.
:call matchadd('ErrorMsg', 'TODO')
matchadd() lets you highlight arbitrary patterns using any highlight group — without touching the search register or search highlighting.
{count}go
The go command moves the cursor to a specific byte offset from the start of the buffer.
'[ and ']
Vim automatically sets two special marks after every change, yank, or put operation: '[ and '].
\@<=
The \@<= operator is Vim's zero-width look-behind assertion.
zd
zd removes the fold definition at the cursor position — the text inside the fold is not deleted.
reg_recording() and reg_executing()
Vim exposes two built-in functions for querying the current macro state: regrecording() and regexecuting().
zO
zO (uppercase O) opens the fold under the cursor and all folds nested inside it recursively.