How do you redirect command output to a register or file?
:redir @a | silent messages | redir END
Use :redir to capture command output.
2277 results for "@a"
:redir @a | silent messages | redir END
Use :redir to capture command output.
<C-r>a
In insert mode, press followed by the register name.
:call setreg('a', 'text')
Use setreg() to set register contents from Vimscript.
<C-v>jjg<C-a>
Select a column of identical numbers with , then press g to create an incrementing sequence (1,2,3.
:let @a='...' in vimrc
Add let @a='macro-keystrokes' to your vimrc file to have the macro available in every Vim session.
qa/[A-Z]\ni_<Esc>l~q
Record a macro that finds the next uppercase letter, inserts an underscore before it, and lowercases it.
<C-v>jj<C-a>
Select numbers with visual block mode , then press to increment all selected numbers by 1.
:g/pattern/norm @a
The :g/pattern/norm @a command combines the global command with macro execution.
:let @a = substitute(@a, 'old', 'new', 'g')
After recording a macro or yanking text into a named register, you may need to tweak it — fix a typo in a recorded macro, change a variable name in yanked tex
qaA,<Esc>jq
Record a macro that moves to end of line with A, types a comma, escapes to normal mode, and moves down.
"ayiw
Use "a to specify register a, then yiw to yank the inner word.
:vsplit filename
Use :vsplit filename or :vsp filename to open a file in a new vertical split to the left of the current window.
:vert sb 3
Use :vert sb 3 to open buffer 3 in a vertical split.
:split filename
Use :split filename or :sp filename to open a file in a new horizontal split.
:let @a = ""
The :let @{register} = "" command empties a register.
qaI <Esc>jq
Record a macro that inserts two spaces at the beginning of the line and moves down.
qa...q
Press q followed by a lowercase letter (a-z) to start recording into that register.
:let @a = substitute(@a, "old", "new", "g")
When a recorded macro has a typo or wrong command buried inside it, you don't have to re-record the entire thing.
:10,20d
Specify a line range before a command.
"ayis
Use "ayis to yank the inner sentence into register a.