How do I convert a recorded macro into a permanent key mapping?
:let @q then use in nnoremap
Macros are stored in registers as plain keystroke strings.
161 results for "paste"
:let @q then use in nnoremap
Macros are stored in registers as plain keystroke strings.
: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
"-
Vim silently stores every deletion of less than one line in the special "- register (the "small delete" register).
:let @a = @a . @b
You can manipulate register contents directly using the :let command with the @{reg} syntax.
"-p
The small delete register ("-) captures text from delete operations that are less than one line — like dw, x, dt.
:g/pattern/yank A
The :g command combined with yank A (uppercase A to append) lets you collect every line matching a pattern into a single register without overwriting previous c
command-line #editing #ex-commands #global-command #registers #filtering
:%s/pattern/\=@0/g
The \=@0 replacement expression inserts the contents of register 0 (last yank) as the replacement text.
:let @a = "content"
When a recorded macro has a typo or needs a small tweak, you don't have to re-record it entirely.
qama{edits}'aq
How it works When a macro needs to jump to different parts of the file and then return to a starting position, marks are the perfect tool.
q: or <C-f> from : prompt
The command-line window (q:) opens a full Vim buffer containing your Ex command history.
":p
The : register holds the most recently executed Ex command.
registers #registers #ex-commands #normal-mode #productivity
"_d
The "d command deletes text using the black hole register ("), which discards the deleted content instead of storing it.
":
The : register contains the last Ex command that was executed.
"/ register
The / register contains the most recent search pattern.
"# register
The # register contains the name of the alternate file — the previously edited file in the current window.
`[v`]
The ` [v] sequence visually selects the exact region of text that was last changed, pasted, or yanked into the buffer.
visual-mode #editing #visual-mode #marks #paste #productivity
oil.nvim: edit directory listing like a buffer
oil.
".
The .
qa f,ldt,F(p q
This macro swaps two comma-separated arguments inside parentheses by cutting the second argument and placing it before the first.
:let @b = @a
The :let @b = @a command copies the contents of register a into register b.