How do I save and restore macros across Vim sessions?
:wviminfo / :rviminfo
Vim can persist register contents (including macros) across sessions using viminfo (Vim) or shada (Neovim).
233 results for "10@a"
:wviminfo / :rviminfo
Vim can persist register contents (including macros) across sessions using viminfo (Vim) or shada (Neovim).
@a (within macro @b)
Vim macros can call other macros, enabling modular macro composition.
:%norm A;
The :%norm command runs normal mode commands on every line in the file (or a range).
{count}<C-a> / {count}<C-x>
While increments and decrements a number by 1, you can prefix either with a count to add or subtract a specific amount.
:'<,'>s/^/\=line('.')-line("'<")+1 . '. '/
When you need quick numbered steps, logs, or checklist entries, this pattern adds numbers only to the lines you selected, not the whole buffer.
:colder
Vim maintains a history stack of up to 10 quickfix lists.
buffers-windows #buffers-windows #navigation #ex-commands #search
:set wrapscan!
wrapscan controls what happens when a / or ? search reaches the end (or beginning) of the file.
<C-w>+ and <C-w>-
The + and - commands increase or decrease the height of the current split window by one line.
:%!command
:%!{command} replaces the entire buffer contents with the output of piping them through a shell command.
` vs '
Vim offers two ways to jump to a mark, and the difference is crucial: the backtick (` `) jumps to the exact line and column where the mark was set, while the si
<C-a> / <C-x>
Pressing increments and decrements the number under or after the cursor.
getbufline() / setbufline()
The getbufline() and setbufline() functions let you inspect and update any loaded buffer's contents from Vimscript without switching the active window.
gra
Since Neovim 0.
:[range]luado {lua-expr}
Neovim's :luado command runs a Lua expression on each line of a range, allowing you to transform text using the full power of Lua's string library.
:.!{cmd}
:.
:v/pattern/command
:v (short for :vglobal) is the inverse of :g.
{n}<C-w>>
All four window resize mappings accept an optional count prefix that multiplies the resize amount.
<C-u>
The (Ctrl+u) command scrolls the window up by half a screen, moving the cursor along with it.
:s/pattern/\=expression/
The \= prefix in the replacement field of :s/// tells Vim to evaluate the right-hand side as a Vim script expression and use the result as the replacement text.
<C-w>_ and <C-w>=
When working with multiple splits, you often want to focus on one window by making it as large as possible, then restore equal sizing when you're done.