How do I programmatically set a register's content in Vim without yanking?
Vim's :let command lets you assign a value directly to any named register without performing a yank or delete operation.
category:
registers
tags:
#registers
#macros
#vimscript
#ex-commands
#normal-mode
How do I choose from multiple tag matches when a tag has several definitions?
When a tag has multiple definitions (e.
category:
navigation
tags:
#navigation
#ex-commands
How do I make Ctrl-A and Ctrl-X increment and decrement alphabetical characters in Vim?
By default, Vim's and commands only increment and decrement numbers (decimal, hex, binary).
category:
config
tags:
#config
#editing
#normal-mode
#macros
How do I stop Vim from automatically continuing comment markers when I press Enter or open a new line?
By default, Vim continues the current comment leader when you press in insert mode or open a new line with o/O.
category:
config
tags:
#config
#editing
#formatting
#ex-commands
How do I limit a search or substitution to only the text I visually selected?
The \%V atom in a Vim pattern matches only inside the last visual selection.
category:
search
tags:
#search
#visual-mode
#substitute
#regex
#text-objects
How do I use marks to define a range for Ex commands?
Marks can be used as range specifiers in any Ex command.
category:
command-line
tags:
#marks
#command-line
#ex-commands
#ranges
#editing
How do I search for a pattern across multiple files?
:vimgrep /pattern/ **/*.ext
The :vimgrep command searches for a pattern across multiple files and populates the quickfix list with the results.
category:
search
tags:
#search
#ex-commands
How do I restrict a search or substitution to exactly the characters I visually selected?
\%V (in search/substitute pattern)
The \%V atom in a Vim pattern matches only inside the last visual selection.
category:
search
tags:
#search
#visual-mode
#substitution
#regex
#normal-mode
How do I use a Vim expression as the replacement string in a :s substitution?
Vim's :s command normally replaces matches with a literal string.
category:
command-line
tags:
#search
#editing
#ex-commands
#command-line
#registers
How do I progressively expand or contract a visual selection by text objects?
In visual mode, repeating text object motions progressively expands the selection.
category:
visual-mode
tags:
#visual-mode
#text-objects
#selection
#motions
How do I open a terminal in the current window instead of a new split?
By default, :terminal opens a new split window for the terminal emulator.
category:
buffers-windows
tags:
#terminal
#buffers
#windows
#shell
#ex-commands
How do I close a buffer without closing the window?
The :bp bd # command switches to the previous buffer and then deletes the alternate buffer.
category:
buffers-windows
tags:
#buffers
#windows
#ex-commands
How do I run a macro only between two marks without entering Visual mode?
When you need to replay a macro on a precise region, selecting lines manually can be slow and error-prone.
category:
macros
tags:
#macros
#marks
#command-line
#normal-mode
How do I completely remove a buffer from Vim?
The :bwipeout command (:bw) completely removes a buffer from Vim's memory, including its marks, options, and variables.
category:
buffers-windows
tags:
#buffers
#ex-commands
How do I comment out multiple lines at once in Vim without a plugin?
Vim's Visual Block mode lets you prepend characters (like comment markers) to multiple lines simultaneously.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I make Ctrl-A and Ctrl-X increment and decrement alphabetic characters?
By default, and only increment and decrement numbers (decimal, hex, and octal depending on format).
category:
config
tags:
#editing
#normal-mode
#config
#increment
How do I run normal mode edits on every line matching a pattern?
The :global command combined with :normal lets you execute arbitrary normal mode keystrokes on every line that matches a pattern.
category:
command-line
tags:
#global
#normal-mode
#editing
#ex-commands
#batch-editing
How do I inspect only Ex command history so I can quickly rerun a complex command?
When you work with long substitution pipelines or multi-part Ex commands, digging through all history (:history) adds noise.
category:
command-line
tags:
#command-line
#history
#ex-commands
#workflow
How do I run a recorded macro across multiple files at once?
Combining :argdo with :norm @a lets you apply a recorded macro to every file in Vim's argument list — a powerful pattern for bulk refactoring across a project
category:
macros
tags:
#macros
#ex-commands
#editing
#buffers
How do I split a line by inserting a newline with the substitute command?
In Vim's substitute command, use \r (not \n) in the replacement to insert a real newline.
category:
editing
tags:
#editing
#search
#ex-commands
#substitution