How do I quickly surround a word with quotes, brackets, or parentheses?
Vim doesn't have a built-in "surround" operator, but you can wrap any word in quotes or brackets with a short sequence: ciw""P.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#productivity
#surround
How do I move a split window into its own tab?
The T (Ctrl+w then Shift+t) command moves the current split window into a new tab page.
category:
buffers-windows
tags:
#buffers-windows
#windows
#tabs
#normal-mode
How do I move to the end of the visible screen line when text is soft-wrapped?
The g$ command moves the cursor to the last character of the current screen line, not the end of the logical line.
category:
navigation
tags:
#navigation
#motions
#wrap
#normal-mode
How do I search for the word under the cursor without whole-word boundaries?
The g command searches forward for the text under the cursor without adding word boundary anchors.
category:
search
tags:
#search
#navigation
#normal-mode
#motions
#productivity
How do I make a macro run repeatedly until it reaches the end of the file or encounters an error?
A recursive macro is a macro that calls itself at the end of its recording.
category:
macros
tags:
#macros
#editing
#normal-mode
#registers
How do I edit an existing macro without re-recording it from scratch?
When a recorded macro contains a typo or needs a small tweak, you can modify it directly via the :let command rather than re-recording the entire sequence.
category:
macros
tags:
#macros
#registers
#editing
#normal-mode
How do I jump to the position of my last edit?
The ` .
category:
navigation
tags:
#navigation
#marks
#normal-mode
#editing
How do I quickly delete all the arguments inside a function call?
The di( command deletes everything inside the nearest pair of parentheses without removing the parentheses themselves.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#delete
#code
How do I append yanked text to an existing register without overwriting it in Vim?
Using an uppercase register letter with any operator appends to the register instead of replacing it.
category:
registers
tags:
#registers
#yank
#delete
#editing
#normal-mode
How do I control which number formats Vim uses when incrementing and decrementing with Ctrl-A and Ctrl-X?
The nrformats option tells Vim how to interpret numbers when you press (increment) or (decrement).
category:
config
tags:
#config
#editing
#increment
#numbers
#normal-mode
How do I create a mapping that calls a script-local function in Vim without namespace collisions?
(Script ID) is a Vimscript token that expands to a unique, per-script prefix at runtime.
category:
config
tags:
#config
#vimscript
#mappings
#functions
#normal-mode
How do I record a self-repeating recursive macro that automatically stops when it hits an error?
A recursive macro is one that calls itself at the end of its own recording.
category:
macros
tags:
#macros
#registers
#normal-mode
How do I indent or unindent the current line while staying in Insert mode?
While in Insert mode, you can adjust indentation without switching back to Normal mode.
category:
editing
tags:
#editing
#insert-mode
#indentation
How do I write a Vim macro that automatically repeats until it fails?
A recursive macro is one that calls itself as its final action, causing it to repeat indefinitely until any command in the body fails (e.
category:
macros
tags:
#macros
#registers
#normal-mode
#editing
How do I scroll the screen so the current line is at the top?
The zt command repositions the viewport so that the line where your cursor sits moves to the top of the screen, without changing your cursor position within the
category:
navigation
tags:
#navigation
#scrolling
#normal-mode
#viewport
#productivity
How do I jump to the global definition of a variable or function in Vim?
How it works Vim provides two built-in commands for jumping to where an identifier is defined, without needing tags or an LSP: gd (lowercase) searches backward
category:
navigation
tags:
#navigation
#normal-mode
#motions
How do I select a rectangular block of text in Vim?
The (Ctrl+v) command enters visual block mode, which lets you select a rectangular column of text across multiple lines.
category:
visual-mode
tags:
#visual-mode
#editing
#normal-mode
How do I add more commands to a macro I already recorded?
If you finish recording a macro and realize you forgot a step, you don't need to re-record the whole thing.
category:
macros
tags:
#macros
#registers
#normal-mode
#editing
#productivity
How do I delete or change an entire paragraph of text in one motion?
The dap and dip commands use Vim's paragraph text objects to delete an entire block of contiguous text in a single motion.
category:
editing
tags:
#editing
#text-objects
#normal-mode
#delete
#motions
How do I open a terminal inside Vim?
The :terminal command opens an interactive terminal emulator directly inside a Vim window.
category:
command-line
tags:
#command-line
#ex-commands
#buffers-windows