How do I make the indent width automatically match the tabstop setting without keeping them in sync manually?
Setting shiftwidth=0 tells Vim to use the value of tabstop wherever shiftwidth would normally be consulted — for the > and and in insert mode, and auto-indent
category:
config
tags:
#indentation
#config
#editing
#ex-commands
How do I make half-page scrolling move through wrapped lines instead of jumping over them in Neovim?
By default, Neovim's half-page scroll commands (, , , ) count movement by text lines, not screen rows.
category:
config
tags:
#config
#navigation
#scrolling
How do I configure Vim's command-line tab completion to show a list of matches?
:set wildmode=longest,list
By default, Vim's command-line completion just cycles through matches one at a time.
category:
config
tags:
#config
#ex-commands
#completion
#command-line
How do I repeat the last substitute command quickly?
The & command in normal mode repeats the last :s substitution on the current line.
category:
search
tags:
#search
#substitution
#ex-commands
#repeat
#normal-mode
How do I make the active window automatically expand to take up most of the screen?
:set winheight=999 winminheight=5
Setting winheight to a very large number forces Vim to always try to make the focused window as tall as possible.
category:
buffers-windows
tags:
#buffers
#windows
#config
#navigation
How do I move through search matches while still typing the pattern?
While the search prompt is open (with incsearch enabled), pressing advances the cursor to the next match and moves it to the previous match — all without leav
category:
search
tags:
#search
#incsearch
#navigation
How do I toggle all folding on and off globally with a single keystroke?
Pressing zi in normal mode toggles the foldenable option, which controls whether folds are active in the current window.
category:
config
tags:
#folding
#normal-mode
#config
How do I undo all changes made in the last N minutes using time-based undo?
Vim's :earlier command lets you travel back through the undo history by wall-clock time rather than by the number of changes.
category:
editing
tags:
#undo-redo
#editing
#ex-commands
How do I move all lines matching a pattern to the top or bottom of a file?
The :global command combined with :move lets you restructure a file by relocating all lines that match a pattern.
category:
editing
tags:
#ex-commands
#editing
#text-objects
How do I trigger wildcard filename completion from inside a custom key mapping in Vim?
The wildchar option (default ) triggers wildcard completion interactively on the command line.
category:
config
tags:
#config
#macros
#command-line
#completion
How do I create a key mapping that behaves differently depending on context?
: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.
category:
config
tags:
#config
#normal-mode
#ex-commands
#navigation
How do I use Neovim's built-in default LSP keymaps for rename, references, and code actions?
Neovim 0.
category:
plugins
tags:
#navigation
#completion
How do I paste text and leave the cursor after the pasted content instead of on it?
The standard p command pastes text after the cursor but leaves the cursor at the beginning of the pasted text.
category:
navigation
tags:
#editing
#registers
#normal-mode
#paste
How do I define autocmds safely so they don't duplicate when my vimrc is re-sourced?
Wrapping autocmds in a named augroup with autocmd! at the start prevents duplicate autocommands from accumulating every time your vimrc is sourced.
category:
config
tags:
#config
#ex-commands
#editing
How do I search and replace only whole word matches, not partial matches?
Wrapping your search pattern in \ word boundary anchors ensures that Vim only matches the exact whole word, preventing accidental replacements inside longer wor
category:
search
tags:
#search
#substitution
#regex
#ex-commands
#editing
How do I prompt the user for input in the middle of a mapping or Vimscript function?
The built-in input() function pauses execution, displays a prompt at the bottom of the screen, and returns whatever the user types before pressing Enter.
category:
macros
tags:
#macros
#editing
#ex-commands
#insert-mode
How do I run a macro a specific number of times without using a recursive macro?
Prefix a macro invocation with a count to execute it up to N times in a single command.
category:
macros
tags:
#macros
#registers
#normal-mode
#editing
How do I align text around a delimiter character using vim-lion?
vim-lion (by Tom McDonald) adds gl and gL as alignment operators.
category:
plugins
tags:
#plugins
#editing
#formatting
How do I check whether a register contains characterwise, linewise, or blockwise text?
The getregtype() function returns the motion type of a register's content — whether it was yanked characterwise, linewise, or as a visual block.
category:
registers
tags:
#registers
#ex-commands
#macros
How do I browse through my previous quickfix lists?
Vim remembers up to 10 previous quickfix lists.
category:
buffers-windows
tags:
#buffers
#quickfix
#navigation
#history