How do I record a macro directly into the system clipboard register?
"+q{keys}q
You can record macros into any register, including the system clipboard (+).
2125 results for "i" a""
"+q{keys}q
You can record macros into any register, including the system clipboard (+).
:[{,]}s/old/new/g
By using the range [{,]}, you can limit a substitute command to the lines between the enclosing braces — effectively the current function or block.
:%s/,/\r/g
In Vim's substitute command, \r in the replacement string inserts a newline.
I{text}<Esc>
When you need to add the same prefix to many adjacent lines, Visual Block insert is faster and safer than repeating macros or substitutions.
`{mark}
The backtick command ` ` followed by a mark name jumps to the exact line and column of that mark, unlike the single-quote ' which only goes to the line.
[i
Pressing [i in normal mode displays the first line above the cursor (including included files) that contains the keyword under the cursor.
:let @a = "value"
The :let @{reg} = expr command lets you assign any string or expression directly into a named register without entering insert mode or performing a yank.
@a (within macro @b)
Vim macros can call other macros, enabling modular macro composition.
<C-w>> and <C-w><
The > and > increases width by 1 column > increases width by 10 columns maximizes the window width Example With a vertical split, 20> gives the current window 2
:b {number}
The :b command followed by a buffer number switches directly to that buffer.
:g/pattern/put ='text'
Combining :global with :put = lets you insert synthesized lines of content after every line matching a pattern — without plugins or complex macros.
:let @a = @a . @b
You can manipulate register contents directly using the :let command with the @{reg} syntax.
:g/pattern/y A
The :g/pattern/y A command yanks every line matching the pattern and appends it to register a.
command-line #command-line #registers #global #ex-commands #filtering
:execute "command"
The :execute command evaluates a string expression and runs it as an Ex command.
/pattern\@!
The \@! atom is a negative lookahead in Vim regex.
:/start/,/end/s/pattern/replacement/g
You can restrict a substitution to a range defined by two patterns.
qa<C-a>jq
By recording a one-step macro that increments a number and moves down a line, you can bulk-apply across as many lines as needed with a single count.
:call setreg('b', getreg('a'), getregtype('a'))
Plain register copies like :let @b = @a move text, but they can lose important metadata about register type.
:let g:netrw_liststyle=3
Vim ships with a built-in file browser called netrw, opened with :Explore (or :Ex).
:redir @a | messages | redir END<CR>
When debugging a session or building repeatable edits, it is useful to turn command output into editable text.