How do I edit a recorded macro without re-recording it from scratch?
Macros are stored as plain text in named registers.
category:
macros
tags:
#macros
#registers
#editing
How do I execute a Vimscript expression as a macro without recording it?
The @= command lets you type a Vimscript expression and execute the result as if it were a macro.
category:
macros
tags:
#macros
#registers
#ex-commands
How do I insert the word under the cursor into the Vim command line?
When typing a command on the Vim command line, pressing inserts the word currently under the cursor.
category:
registers
tags:
#command-line
#registers
#editing
How do I edit a recorded macro to fix a mistake without re-recording it?
When a macro has a small mistake, re-recording the entire thing is tedious.
category:
macros
tags:
#macros
#registers
#editing
How do you assign text to a register using :let?
Use :let @a = 'text' to set register a to any string.
category:
registers
tags:
#registers
#let
#assign
How do you yank the same text to multiple registers?
Yank the line twice into different registers.
category:
registers
tags:
#registers
#multiple
#yank
How do you yank a single word into a named register?
Use "a to specify register a, then yiw to yank the inner word.
category:
registers
tags:
#registers
#yank
#word
How do you yank lines between two marks into a register?
Set marks with ma and mb, then yank the range between them into register a using "a:'a,'by.
category:
registers
tags:
#registers
#marks
#yank
How do you yank an entire paragraph into a named register?
Use "ayip to yank the inner paragraph into register a.
category:
registers
tags:
#registers
#yank
#paragraph
How do you yank a sentence into a named register?
Use "ayis to yank the inner sentence into register a.
category:
registers
tags:
#registers
#yank
#sentence
How do you yank a visual block selection to a register?
Enter visual block mode with , select the block, then "ay to yank the block into register a.
category:
registers
tags:
#registers
#block
#yank
How do you yank the entire file contents into a register?
Go to the first line with gg, then visually select from there to the last line with VG, and yank into register a.
category:
registers
tags:
#registers
#yank
#entire-file
How do you yank an entire function body into a register?
Position cursor in a function, use VaB to visually select the block including braces, then "ay to yank into register a.
category:
registers
tags:
#registers
#yank
#function
How do you use text from one register inside a macro?
While recording macro a, paste from register b with "bp.
category:
registers
tags:
#registers
#macro
#paste
How do you use a register value in a substitute command?
In command-line mode, a inserts the contents of register a.
category:
registers
tags:
#registers
#substitute
#search
What is the unnamed register and how does it work?
The unnamed register "" is the default target for yank, delete, and change operations.
category:
registers
tags:
#registers
#unnamed
#default
How do you set the search register programmatically?
Use :let @/ = 'pattern' to set the search register directly.
category:
registers
tags:
#registers
#search
#set
What is the selection register in Vim and how do you use it?
The register represents the primary selection (middle-click paste in X11).
category:
registers
tags:
#registers
#selection
#primary
How do you set a register programmatically in Vim?
:call setreg('a', 'text')
Use setreg() to set register contents from Vimscript.
category:
registers
tags:
#registers
#setreg
#function
How do you paste over a visual selection without losing the register?
When pasting over a selection, the replaced text overwrites the unnamed register.
category:
registers
tags:
#registers
#paste
#selection