How do I visually display tabs, trailing spaces, and end-of-line characters in Vim?
:set list listchars=tab:>-,trail:~,eol:$
Enabling list mode makes Vim render normally invisible characters using configurable symbols defined in listchars.
:set list listchars=tab:>-,trail:~,eol:$
Enabling list mode makes Vim render normally invisible characters using configurable symbols defined in listchars.
:earlier {N}m
Vim's :earlier command lets you travel back through the undo history by wall-clock time rather than by the number of changes.
gra
Since Neovim 0.
set completeopt+=popup
Adding popup to completeopt makes Vim display extra information — such as function signatures or documentation — for the currently highlighted completion it
set colorcolumn=+1
The colorcolumn option highlights one or more vertical columns to help keep lines within a length limit.
:ce
Vim has three built-in ex commands for text alignment that most users never discover: :ce (center), :ri (right-justify), and :le (left-justify).
:{range}center {width}
Vim has built-in Ex commands for text alignment: :center, :right, and :left.
command-line #ex-commands #formatting #editing #command-line
:delmarks!
Marks accumulate as you work — ma, mb, mc and so on record positions for later jumps.
zA
The zA command toggles the fold under the cursor together with all nested sub-folds in one keystroke.
gq{motion}
The gq{motion} operator reformats text to fit within Vim's textwidth setting, inserting hard line breaks where lines are too long.
:s/\(\w\+\) \(\w\+\)/\=submatch(2) . ' ' . submatch(1)/
The submatch(N) function lets you access individual capture groups inside a \= (expression replacement) in a substitution.
:/pattern/+N and :/pattern/-N
Vim's Ex command ranges can use search patterns as line addresses, and those addresses can include a numeric offset (+N or -N) to target lines relative to the m
:undo {N}
:undo {N} lets you jump directly to the undo tree state after change number N was applied.
:g/pattern/put ='text'
Combining :global with :put = lets you insert synthesized lines of content after every line matching a pattern — without plugins or complex macros.
<C-k>{digraph}
Vim's digraph system lets you insert special characters, accented letters, and symbols by typing a memorable two-character sequence.
:set showbreak=+++
When wrap is enabled, Vim wraps long lines at the screen edge, but there is no built-in visual marker to distinguish a wrapped continuation from a brand-new lin
:%TOhtml
Vim ships with a built-in plugin that converts the current buffer into a standalone HTML file, complete with your exact syntax highlighting colors.
:%s/,/,\r/g
In Vim substitutions, \n and \r behave differently depending on whether they appear in the search pattern or the replacement string — a common gotcha that sur
"1p and .
When you paste from a numbered register with "1p, Vim's dot command (.
:center / :right / :left
Vim has built-in Ex commands to align text: :center, :right, and :left.