How do I access the alternate file register?
"# register
The # register contains the name of the alternate file — the previously edited file in the current window.
197 results for "registers"
"# register
The # register contains the name of the alternate file — the previously edited file in the current window.
".
The .
"=2+3<CR>p
The expression register = evaluates a Vimscript expression and stores the result.
@q
A recursive macro is a macro that calls itself as its last step, causing it to loop automatically until an operation fails (such as reaching the end of the file
"+yy
The "+yy command yanks the current line directly to the system clipboard register, making it available for pasting in other applications.
"+y and "+p
The "+ register is linked to the system clipboard.
:let @a = "Iprefix: \<Esc>"
The :let @a = ".
:10,20t30
The :t command (short for :copy) duplicates lines from one location to another without touching any registers.
command-line #editing #ex-commands #lines #productivity #ranges
<C-r>{reg} in command line
While on the : command line, pressing followed by a register name inserts that register's contents.
qaciw"<C-r>""<Esc>wq
This macro wraps the current word in double quotes by changing the word, inserting quotes around the original content, and moving to the next word.
Use :let i=1 with macro
By combining a Vimscript variable with a macro, you can create sequences with incrementing numbers.
yy
The yy command yanks (copies) the entire current line, including the newline character.
Paste with "ap and execute keys manually
To debug a macro, paste its contents into the buffer, read each keystroke, and execute them one at a time to find where the macro goes wrong.
"+q{keys}q
You can record macros into any register, including the system clipboard (+).
y/<C-r>"<CR>
To search for the exact text you have selected in visual mode, yank it and paste it into the search prompt.
qa ... q ... @a
Macros let you record a sequence of commands and replay them.
:nnoremap <leader>d "=strftime('%Y-%m-%d')<CR>p
The expression register (=) evaluates Vimscript expressions and uses the result as register content.
P
The P (uppercase) command pastes the contents of the default register before the cursor position.
:filter /pattern/ command
The :filter command restricts the output of another Ex command to only lines matching a given pattern.
:put =map(getreg('a', 1, 1), 'toupper(v:val)')
By using getreg() with the list flag and applying map(), you can transform register contents with any Vimscript function before pasting.