How do I control the exact indentation amount for continuation lines when text wrapping is enabled?
:set breakindentopt=shift:2
When breakindent is enabled, wrapped continuation lines are indented to match the start of their logical line.
162 results for "{n}G"
:set breakindentopt=shift:2
When breakindent is enabled, wrapped continuation lines are indented to match the start of their logical line.
matchadd()
The matchadd() function adds a persistent highlight for a pattern in the current window without touching your search register or interfering with n/N navigation
"/p
Vim stores the last search pattern in the search register "/.
l (in :%s///gc confirm prompt)
When running an interactive substitution with the c flag (e.
editing #search #editing #substitution #ex-commands #normal-mode
vim.diagnostic.jump()
Neovim 0.
g- / g+
Vim doesn't have a simple linear undo stack — it maintains a full undo tree with branches.
editing #editing #undo-redo #normal-mode #advanced #productivity
:g/^\s*$/d
The global command :g/^\s$/d removes every line that is empty or contains only whitespace — a common cleanup task when tidying up code, configuration files, o
:terminal
The :terminal command opens an interactive terminal emulator directly inside a Vim window.
mode()
The mode() function returns a short string identifying the current editing mode — 'n' for Normal, 'i' for Insert, 'v' for Visual character-wise, 'V' for Visua
macros #macros #normal-mode #visual-mode #insert-mode #editing
\_.
In Vim's regular expressions, .
:let @/='\V'.escape(@", '\\')
When you yank text that contains regex characters like .
:g/pattern/join
The :g/pattern/join command combines the :global command with :join to merge every line matching a pattern with the line immediately following it.
command-line #ex-commands #editing #command-line #search #normal-mode
:%s/pattern/\=expr/g
Prefixing the replacement field of :s with \= tells Vim to evaluate the rest as a Vimscript expression and use its result as the replacement string.
:%s/old/new/gc
Adding the c flag to a substitute command makes Vim pause at every match and ask you whether to replace it.
:'<,'>sort
The :'sort command sorts the currently selected lines in visual mode alphabetically.
:mkview / :loadview
:mkview saves a snapshot of the current window — its fold states, cursor position, and local option values — to a view file on disk.
buffers-windows #folding #buffers-windows #config #ex-commands
:undolist
Vim's undo history is a tree, not a linear stack.
qa<C-a>jq
By recording a one-step macro that increments a number and moves down a line, you can bulk-apply across as many lines as needed with a single count.
:g//d
:g//d uses an empty pattern in the global command, which instructs Vim to reuse the last search pattern.
:set pumheight=10
By default, Vim's completion popup menu (the PUM — Pop-Up Menu) can expand to fill the entire screen if there are many candidates.