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.
233 results for "10@a"
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.
vim.snippet.expand()
Neovim 0.
gaip=
vim-easy-align is a plugin by Junegunn Choi that makes aligning text around delimiters effortless.
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
:{range} normal @{reg}
The :normal command lets you execute Normal mode keystrokes over a range of lines.
<C-w>_ and <C-w>|
When working with multiple splits, you sometimes need to focus on one window temporarily without closing the others.
:set smoothscroll
The smoothscroll option makes scroll commands respect screen rows rather than buffer lines when wrap is enabled.
:[range]normal @q
The :[range]normal @q command replays the macro in register q on every line within a given range.
:g/^$/d
The :g/^$/d command deletes every blank line in the file using Vim's powerful global command.
vim.fs.root()
vim.
:[range]yank {reg}
Vim's :[range]yank and :[range]delete Ex commands let you capture arbitrary line ranges into a register from the command line, bypassing the need to move the cu
vim.ui.open()
vim.
]' and ['
The ]' and [' motions let you traverse every lowercase mark set in the current buffer without needing to remember which registers you used.
:earlier
Vim's undo history is not just a linear list of changes — it records timestamps too.
g; / g,
The g; and g, commands let you navigate Vim's changelist — a per-buffer history of every position where you made a change.
navigation #navigation #changelist #editing #normal-mode #marks
:'<,'>normal @a
The :'normal @a command executes the macro stored in register a on every line within the current visual selection.
json_encode()
Vim 8.
:g/pattern/command
The :g/pattern/command (global) command executes an Ex command on every line in the file that matches the given pattern.
:g/pattern/normal dd
The :g/pattern/normal {commands} command executes normal mode keystrokes on every line in the file that matches the given pattern.
:tags
The :tags command displays the tag stack, showing all the tag jumps you have made with and their return points.