How do I split a complex Vim macro into reusable subroutines?
Record worker macro in @b, call it from @a with @b
Complex macros are hard to debug and maintain when crammed into a single register.
399 results for "it at"
Record worker macro in @b, call it from @a with @b
Complex macros are hard to debug and maintain when crammed into a single register.
<C-o> / <C-i>
Vim maintains a jumplist — a history of every "jump" you make (searches, marks, gg, G, %, etc.
f{char}
The f{char} command moves the cursor forward to the next occurrence of {char} on the current line.
:'<,'>norm {commands}
The :normal (or :norm) command lets you execute normal mode keystrokes from the command line.
command-line #editing #ex-commands #normal-mode #productivity #ranges
qa:s/old/new/g<CR>jq
How it works You can combine Ex commands like :s (substitute) with macro recording to create powerful repeatable find-and-replace operations that go beyond what
[I
How it works The [I command searches the current file (and included files) for the word under the cursor and displays a list of all matching lines with their li
:jumps
How it works Vim keeps a jump list that records your cursor position every time you make a jump.
]s and [s
How it works When spell checking is enabled in Vim with :set spell, misspelled words are highlighted.
:lcd {dir}
:lcd (local cd) sets the working directory for the current window only, leaving other windows at their previous directory.
buffers-windows #buffers-windows #navigation #ex-commands #config
-
vim-vinegar is a lightweight plugin by Tim Pope that enhances Vim's built-in file browser (netrw) with a simpler, more intuitive workflow.
/pattern
The /pattern command searches forward through the file for the given pattern.
:iabbrev teh the
Vim's abbreviation feature lets you define automatic text replacements that trigger as you type.
:%Subvert/old/new/g
The vim-abolish plugin by Tim Pope provides the :Subvert command (abbreviated :S), which performs search-and-replace operations that automatically handle every
( and )
How it works Vim defines a sentence as text ending with .
{count}@{register}
Prefix any macro execution with a count to repeat it that many times in a single command.
grn / grc / grm
Neovim's nvim-treesitter plugin provides incremental selection based on the abstract syntax tree (AST) of your code.
q: or <C-f> from : prompt
The command-line window (q:) opens a full Vim buffer containing your Ex command history.
"+p
The "+p command pastes the contents of the system clipboard into Vim.
":p
The : register holds the most recently executed Ex command.
registers #registers #ex-commands #normal-mode #productivity
qqqqqq{edits}@qq
A recursive macro calls itself at the end of its sequence, creating a loop that automatically repeats until a motion or command fails (such as hitting the last