How do I yank text inside delimiters into a specific named register?
"ayi(
Combining named registers with text object motions lets you precisely yank structured content — like function arguments, quoted strings, or bracketed expressi
"ayi(
Combining named registers with text object motions lets you precisely yank structured content — like function arguments, quoted strings, or bracketed expressi
:nnoremap <leader>d "=strftime('%Y-%m-%d')<CR>p
The expression register (=) evaluates Vimscript expressions and uses the result as register content.
:echo @%
Vim provides special read-only registers that hold the current and alternate filenames.
@a (within macro @b)
Vim macros can call other macros, enabling modular macro composition.
: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.
<C-r><C-r>a
In insert mode, a pastes register a but processes the text as if typed, which can trigger abbreviations and mappings.
:let @a = ''
Registers persist their contents throughout your Vim session and even across sessions if viminfo or shada is enabled.
:call setreg('a', @a, 'l')
Registers in Vim have a type — characterwise, linewise, or blockwise — that affects how their contents are pasted.
:let g:debug_macro=1 | normal @a
When a macro doesn't work as expected, debugging it step by step is essential.
:keeppattern %s/old/new/g
When you run a :s or :%s substitute command, Vim updates the search register (@/) with the substitution pattern.
command-line #ex-commands #search #editing #registers #substitute
<C-r>=system("date")<CR>
The expression register (=) is one of Vim's most powerful yet underused features.
qqq qq{commands}@qq @q
A recursive macro calls itself at the end of its recording, causing it to repeat automatically until a motion fails (like j at the last line).
:let @+ = expand('%:p')
Sometimes you need to share or use the full path of the file you're editing — for a terminal command, a config file, or a chat message.
<C-r><C-o>{register}
The standard {reg} pastes register contents in Insert mode, but Vim may auto-indent multi-line text to match the current indentation level — sometimes manglin
When recording a macro, you can execute another macro inside it by pressing @b (or any register) during the recording.
"/p
Vim stores the last search pattern in the search register "/.
<C-r>0
In Insert mode, {reg} pastes the contents of any register inline at the cursor.
:put ={expression}
The :put command inserts the contents of a register as a new line below the cursor.
:let @q = '{keystrokes}'
You can assign a string directly to any register using :let @{reg} = '.
<C-r>:
Vim stores your last executed Ex command in the read-only : register.