How do I run a macro on every line in the entire file?
:%normal @q
To apply a macro to every line in the file, use :%normal @q.
1019 results for "i" a""
:%normal @q
To apply a macro to every line in the file, use :%normal @q.
<C-v>j$A;<Esc>
When lines have varying lengths, a normal visual block selection stops at the shortest line.
:cq
The :cq command quits Vim and returns a non-zero exit code to the calling process.
:'<,'>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
<C-v>jj$A text<Esc>
Visual block mode combined with $A lets you append text to the end of multiple lines simultaneously, even when those lines have different lengths.
visual-mode #editing #visual-mode #block-mode #productivity #insert-mode
:sort
The :sort command sorts lines in the current buffer or a specified range alphabetically.
:[range]normal @q
The :[range]normal @q command replays the macro in register q on every line within a given range.
:set mouse=a
How it works The :set mouse=a command enables mouse support in all Vim modes.
Write keystrokes in buffer, then "qy$
Instead of recording a macro in real-time (where mistakes mean starting over), you can write the keystrokes as text in a buffer, edit them visually, and then ya
macros #macros #editing #registers #workflow #best-practices
<C-v>jjjg<C-a>
Selecting a column of identical numbers with visual block mode and pressing g turns them into an incrementing sequence.
qaA;<Esc>jq
This macro appends a semicolon to the current line and moves down, ready to repeat.
"adiw
The "adiw command deletes the inner word under the cursor and stores it in register a.
<C-v>u{hex}
In insert mode, pressing followed by u and a 4-digit hexadecimal codepoint inserts the corresponding Unicode character directly into the buffer.
<C-v>u{code}
In insert mode, followed by u and a 4-digit hex code inserts the Unicode character with that code point.
:e #
:e # opens the alternate file — the file you were editing just before the current one.
zf (in visual mode)
In visual mode, pressing zf creates a manual fold from the selected lines.
vi{a{
In visual mode, you can expand your selection to include outer nested blocks by pressing additional text object commands.
/\<word\>
The \ atoms create word boundaries in a search pattern, matching only complete words and not substrings within larger words.
:set inccommand=split
Neovim's inccommand option provides real-time visual feedback as you type substitution commands.
:NERDTreeToggle
The NERDTree plugin provides a full-featured file explorer sidebar in Vim, giving you a visual directory tree that you can navigate, search, and manipulate file