How do you access the last executed command in Vim?
The : register stores the last command-line command.
category:
registers
tags:
#registers
#command
#last
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 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 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 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 access the last inserted text in Vim?
In insert mode, .
category:
registers
tags:
#registers
#last-inserted
#dot
How do you paste from a named register before the cursor?
Use "aP (uppercase P) to paste the contents of register a before the cursor position, as opposed to "ap which pastes after.
category:
registers
tags:
#registers
#paste
#before
How do you paste from a register while in visual mode?
In visual mode, "ap replaces the selected text with the contents of register a.
category:
registers
tags:
#registers
#paste
#visual
How do I copy selected text to the clipboard in visual mode?
In visual mode, pressing y yanks (copies) the selected text into the default register.
category:
visual-mode
tags:
#visual-mode
#registers
#editing
How do you change the case of text stored in a register?
Use Vimscript functions toupper() or tolower() with :let @a = toupper(@a) to convert the case of the entire register contents.
category:
registers
tags:
#registers
#case
#convert
How do you paste from a register with automatic indentation?
Use ]p after specifying a register to paste with adjusted indentation.
category:
registers
tags:
#registers
#paste
#indent
How do you paste a register value into the search prompt?
While in the search prompt (/), press a to insert the contents of register a.
category:
registers
tags:
#registers
#search
#paste
How do you use the expression register to evaluate Vimscript?
In insert mode, = opens the expression register.
category:
registers
tags:
#registers
#expression
#vimscript
How do you retrieve a register's contents in Vimscript?
Use getreg('a') to get the contents of register a as a string.
category:
registers
tags:
#registers
#getreg
#function
How do you paste a register using the :put command?
The :put a command pastes register a on a new line below the cursor.
category:
registers
tags:
#registers
#put
#command
How do you record a macro into a specific named register?
Press q followed by a lowercase letter (a-z) to start recording into that register.
category:
registers
tags:
#registers
#record
#macro
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
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 use text from one register inside a macro?
While recording macro a, paste from register b with "bp.
category:
registers
tags:
#registers
#macro
#paste