How do I use marks inside a macro to return to a specific position?
qama{edits}'aq
How it works When a macro needs to jump to different parts of the file and then return to a starting position, marks are the perfect tool.
1024 results for "i" a""
qama{edits}'aq
How it works When a macro needs to jump to different parts of the file and then return to a starting position, marks are the perfect tool.
<C-a> / <C-x> (vim-speeddating)
vim-speeddating (by Tim Pope) extends Vim's built-in and increment/decrement operators to understand dates, times, roman numerals, and other ordered sequences.
:g/pattern/normal {cmd}
Combining :global with :normal lets you run any normal-mode keystrokes on every line that matches a pattern.
g<C-a> in visual mode
When you have multiple lines with the same number and want to turn them into a sequence (1, 2, 3.
:echo strtrans(@q)
When a macro behaves unexpectedly, :echo strtrans(@q) reveals exactly what is stored in register q—including invisible control characters—as human-readable
:iabbrev {abbr} {expansion}
How it works The :iabbrev command creates abbreviations that automatically expand when you type them in insert mode.
When recording a macro, you can execute another macro inside it by pressing @b (or any register) during the recording.
<C-v>jj$A
Combining visual block mode with $ and A lets you append text at the end of multiple lines, even when the lines have different lengths.
:center 80
Vim has built-in text alignment commands that adjust lines relative to a specified width.
:tabedit
Vim's tab pages let you keep separate window layouts open at the same time, each with its own set of splits.
:b {number}
The :b command followed by a buffer number switches directly to that buffer.
:set textwidth=80
The textwidth option sets the maximum width for text.
) and (
The ) and ( motions move by sentence boundaries.
"add
How it works When you delete text in Vim with commands like dd, dw, or x, the deleted text goes into the unnamed register and the numbered registers (1-9).
:let @q='commands'
Macros in Vim are stored in registers as plain text.
"Ayy
The "Ayy command appends the current line to register a instead of overwriting it.
:set winfixheight
When you have a specific window you want to keep at a fixed size — like a terminal, log viewer, or reference file — winfixheight and winfixwidth prevent Vim
.
The .
\@=
Vim's regex engine supports zero-width lookahead and lookbehind assertions using the \@ family of atoms.
gqap
The gq operator reformats text by wrapping lines to fit within the textwidth setting.