How do I paste the unnamed register after transforming it to uppercase?
Registers in Vim are not only for raw replay; you can treat them as string data and transform them at paste time.
category:
registers
tags:
#registers
#expression-register
#editing
#vimscript
How do I remove accidental Enter keystrokes from a recorded macro?
:let @q = substitute(@q, '\n', '', 'g')
A common macro failure mode is accidentally hitting while recording.
category:
macros
tags:
#macros
#registers
#debugging
#vimscript
How do I paste multiline clipboard text as a comma-separated list in Insert mode?
<C-r>=substitute(getreg('+'), '\n\+', ', ', 'g')<CR>
When you paste from the system clipboard into code or config, multiline text often needs to be flattened first.
category:
registers
tags:
#registers
#insert-mode
#expression-register
#text-processing
How do I insert a register in Insert mode without reindenting each inserted line?
When you paste multiline snippets from a register while in Insert mode, default insertion can trigger indentation and formatting side effects line by line.
category:
registers
tags:
#registers
#insert-mode
#formatting
#indentation
#editing
How do I run vimgrep across a project using whatever pattern is currently in the search register?
:execute 'vimgrep /' . @/ . '/gj **/*'
If you already refined a search interactively with / or ?, retyping that pattern for project-wide grep is repetitive and error-prone.
category:
search
tags:
#search
#vimgrep
#quickfix
#registers
#workflow
How do I append keystrokes to a macro without re-recording it?
Re-recording a long macro just to add one extra keystroke is wasteful and error-prone.
category:
macros
tags:
#macros
#registers
#automation
#editing
How do I search literally for the exact text I yanked last?
:let @/ = '\V' . escape(@0, '\')
When the text you yank contains regex characters, a normal / search can produce noisy or surprising matches.
category:
registers
tags:
#registers
#search
#regex
#command-line
How do I refactor a recorded macro by rewriting its keystrokes with substitute()?
:let @q = substitute(@q, 'foo', 'bar', 'g')
Recorded macros are plain text stored in registers, which means you can refactor them instead of re-recording from scratch.
category:
macros
tags:
#macros
#registers
#automation
#ex-commands
How do I set the search pattern to the current word literally without executing a search in Vim?
:let @/ = '\V' . escape(expand('<cword>'), '\')
This pattern lets you prepare a precise search target without jumping the cursor or triggering an immediate search motion.
category:
search
tags:
#search
#registers
#patterns
#command-line
How do I append new keystrokes to an existing macro register without re-recording it?
Re-recording a long macro just to add one extra step is slow and error-prone.
category:
macros
tags:
#macros
#registers
#automation
#ex-commands
How do I load the search register with a literal <cword> pattern?
:let @/ = '\V' .. escape(expand('<cword>'), '\\')
Sometimes * is too opinionated: it uses keyword boundaries and interprets regex metacharacters.
category:
search
tags:
#search
#registers
#ex-commands
#regex
#navigation
How do I insert a timestamp computed by Vimscript directly from Normal mode?
"=strftime('%Y-%m-%d %H:%M')<CR>p
The expression register lets you evaluate Vimscript on demand and paste the result immediately.
category:
registers
tags:
#registers
#expression-register
#automation
#timestamps
How do I run a one-off macro without recording by executing keystrokes from an expression register?
Recorded macros are powerful, but sometimes you need a quick ephemeral sequence and do not want to occupy a register.
category:
macros
tags:
#macros
#registers
#normal-mode
#automation
How do I copy my most recent yank from register 0 into the system clipboard register?
When you yank text in Vim, register 0 always holds the most recent yank, independent of deletes that may have changed the unnamed register.
category:
registers
tags:
#registers
#clipboard
#yank
#workflow
How do I insert the unnamed register literally in Insert mode without auto-indent side effects?
In Insert mode, plain {register} inserts register content but may reindent or auto-format depending on context.
category:
registers
tags:
#registers
#insert-mode
#editing
#indentation
#text
How do I remove the last recorded keystroke from a register or macro in Vim?
Macros and named registers are just strings, so you can surgically edit them instead of re-recording from scratch.
category:
registers
tags:
#registers
#macros
#vimscript
#editing
How do I edit an existing macro by modifying its register text instead of rerecording it?
:let @q = substitute(@q, '\n$', 'A;<Esc>\n', '')
Rerecording a long macro for one tiny change is slow and error-prone.
category:
macros
tags:
#macros
#registers
#automation
#vimscript
How do I evaluate a Vim expression and paste the result directly from a register?
The expression register lets you compute text on demand and insert it without leaving Normal mode workflows.
category:
registers
tags:
#registers
#expression-register
#normal-mode
#automation
How do I replay macro q from command-line mode without changing @/?
:keeppatterns normal! @q<CR>
When you replay macros from Ex commands, Vim can overwrite @/ (the last search pattern) depending on what the macro does.
category:
macros
tags:
#macros
#registers
#search
#normal-mode
#automation
How do I append multiple yanks into one named register and paste them as one block?
Named registers are much more powerful when you treat them as accumulators instead of one-shot clipboards.
category:
registers
tags:
#registers
#named-registers
#yank
#paste