How do I delete text from the cursor to the next occurrence of a pattern?
Vim lets you use a / search as a motion for any operator.
category:
editing
tags:
#editing
#search
#motions
#delete
#normal-mode
How do I programmatically set a register's content in Vimscript to pre-load a macro?
:let @{reg} = 'string' directly assigns content to any named register from Vimscript.
category:
registers
tags:
#registers
#macros
#ex-commands
#normal-mode
How do I stop Vim from treating numbers with leading zeros as octal when using Ctrl-A or Ctrl-X?
Vim's and increment and decrement numbers under the cursor.
category:
config
tags:
#config
#editing
#normal-mode
How do I re-indent all lines from the cursor to the end of the file in one keystroke?
The =G command applies Vim's auto-indent operator (=) from the current line to the last line of the file (G).
category:
editing
tags:
#editing
#indentation
#normal-mode
#motions
How do I anchor a search or substitution pattern to the current cursor position?
The \%# atom in Vim's regex engine matches the exact position of the cursor — zero-width, between characters.
category:
search
tags:
#search
#normal-mode
#ex-commands
#editing
How do I set a bookmark that persists across different files and Vim sessions?
Vim has two tiers of marks.
category:
navigation
tags:
#marks
#navigation
#normal-mode
How do I overtype text in Vim without breaking column alignment when tabs are involved?
gR enters Virtual Replace mode, a smarter variant of Replace mode (R) that replaces characters based on screen columns rather than raw bytes.
category:
editing
tags:
#editing
#insert-mode
#normal-mode
#formatting
How do I search or substitute only within specific columns of text in Vim?
The \%Nc, \%>Nc, and \%20c — match only after column 20 (i.
category:
search
tags:
#search
#regex
#substitution
#normal-mode
How do I execute a recorded macro a specific number of times?
Prefix the @ macro-execution command with a count to run the macro that many times in a row.
category:
macros
tags:
#macros
#registers
#normal-mode
#editing
How do I scroll the view left and right when lines are wider than the screen?
When nowrap is set and lines extend beyond the screen width, Vim provides dedicated horizontal scroll commands.
category:
navigation
tags:
#navigation
#normal-mode
#buffers-windows
How do I toggle, uppercase, or lowercase text using motion commands in Vim?
Vim has three case-change operators that work like any other operator — you can combine them with motions, text objects, or double them to act on the whole li
category:
visual-mode
tags:
#editing
#visual-mode
#normal-mode
#text-objects
How do I insert the same text at the start of multiple lines using visual block mode?
Visual block mode () lets you select a rectangular region across lines.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I recover text from older deletions using Vim's numbered registers?
Vim automatically stores your deletion history in numbered registers "1 through "9.
category:
registers
tags:
#registers
#editing
#normal-mode
#undo-redo
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 override case sensitivity for a single search pattern without changing my settings?
Vim lets you embed \c or \C directly inside a search pattern to control case sensitivity for that search only, regardless of your 'ignorecase' and 'smartcase' s
category:
search
tags:
#search
#regex
#case
#normal-mode
How do I jump to a mark without adding my current position to the jumplist?
Vim's standard mark-jump commands ('a, ` a `) always add the current position to the jumplist before leaping to the mark.
category:
navigation
tags:
#navigation
#marks
#normal-mode
How do I edit the contents of a macro register without re-recording it?
:let @q = substitute(@q, 'old', 'new', 'g')
When a recorded macro has a typo or needs a small tweak, re-recording the entire thing is error-prone.
category:
macros
tags:
#macros
#registers
#editing
#normal-mode
How do I switch between charwise, linewise, and blockwise visual mode without losing my selection?
Once you are in any visual mode, pressing v, V, or switches to charwise, linewise, or blockwise visual mode respectively — without cancelling the current sele
category:
visual-mode
tags:
#visual-mode
#normal-mode
#editing
How do I selectively replace occurrences one at a time, choosing to apply or skip each match?
The n.
category:
search
tags:
#search
#editing
#normal-mode
#dot-repeat
#motions
How do I pipe the entire buffer through an external shell command like sort, jq, or a formatter?
:%!{command} replaces the entire buffer contents with the output of piping them through a shell command.
category:
editing
tags:
#editing
#ex-commands
#filtering
#normal-mode