How do I keep more marks and registers across sessions by tuning the shada option?
:set shada='200,<1000,s100,h
Default ShaDa settings are conservative, which can make long-running workflows lose useful context between sessions.
:set shada='200,<1000,s100,h
Default ShaDa settings are conservative, which can make long-running workflows lose useful context between sessions.
:echo string(getreg('q'))
Macros can fail for subtle reasons: hidden control keys, extra whitespace, or unexpected register contents.
registers #registers #macros #debugging #automation #command-line
:let @q .= "j^"
Live macro recording is fast, but adjusting the tail of a macro by re-recording can be risky once it already works in most places.
macros #macros #registers #automation #normal-mode #workflow
:set shada
Neovim's ShaDa (Shared Data) file replaces Vim's viminfo and persists session state across restarts — marks, registers, command history, search history, jump
:redir @a | messages | redir END<CR>
When debugging a session or building repeatable edits, it is useful to turn command output into editable text.
"1 through "9
Vim maintains a rotating history of deleted text across registers "1 through "9.
gr{motion}
Neovim 0.
:reg {names}
The :registers command dumps every register at once, which is noisy when you only care about a handful.
<C-r><C-o>
When you paste a register in insert mode with {reg}, Vim inserts the text as if you had typed it — which means auto-indent, abbreviation expansion, and other
registers #registers #insert-mode #paste #autoindent #editing
:let @q .= "keys"
The string concatenation assignment :let @q .
:let @a = @/
Vim stores the last search pattern in the special / register (@/).
:reg a b c
The :reg (alias :registers) command accepts a string of register names as its argument.
getreginfo('a')
getreginfo('{reg}') (Vim 8.
"qp {edit} 0"qy$ dd
When you record a macro and realize it has a mistake, the easiest fix is to paste the macro's keystrokes as text, edit them, and yank the corrected version back
:reg {name}
The :reg {name} command displays the current contents of one or more named registers in a formatted listing.
qaq qa...@aq
A recursive macro calls itself at the end of its recording, causing it to repeat automatically until an error — such as reaching the end of the file — stops
v:event
The v:event dictionary is populated inside certain autocommand callbacks with data specific to that event.
qa{motions}@aq
A recursive macro is one that calls itself at the end of its own recording.
:put =execute('messages')
Vim's :messages command shows recent output — error messages, echo'd values, and diagnostic information — but the display is ephemeral and hard to search.
:let @q = substitute(@q, 'old', 'new', '')
Vim macros are stored as plain text in named registers, which means you can inspect and modify them directly using :let and :echo.