How do I prevent a macro from stopping when a command fails?
Use :s/pat/rep/e flag or :silent! prefix
By default, Vim macros abort on the first error — a failed search, a substitute with no matches, or a movement that can't be performed.
2277 results for "@a"
Use :s/pat/rep/e flag or :silent! prefix
By default, Vim macros abort on the first error — a failed search, a substitute with no matches, or a movement that can't be performed.
vim-startify plugin
vim-startify provides a configurable start screen when you open Vim without a file.
:packadd justify | :'<,'>Justify 72
Vim can wrap text, but full left-and-right justification is a different task.
plugins #plugins #formatting #visual-mode #text-manipulation
<C-x>
The command decrements the number under or after the cursor by 1.
@+
In Vim, @{register} executes the contents of any register as a macro.
ysiwf
vim-surround's f and F surrounds let you wrap any text object inside a function call, prompting you for the function name.
:lvimgrep /\<TODO\>/gj **/* | lopen
If you want project-wide search results without polluting the global quickfix list, use a location list.
matchadd('Group', 'pattern', priority)
matchadd() accepts an optional third argument: a priority integer that controls which match wins when two patterns cover the same text.
qa...@aq
A recursive macro calls itself at the end of its recording, causing it to repeat until a motion or search fails.
:keepmarks %s/pattern/replacement/g
The :keepmarks modifier prevents Vim from adjusting mark positions when a buffer-modifying command runs.
:let @q = substitute(@q, 'from', 'to', 'g')
Macros are stored as plain text in named registers, so you can manipulate them with any Vimscript string function.
v + repeated iw/aw/i(/a(/ip/ap
Once you enter visual mode, you can progressively expand your selection by typing increasingly larger text objects.
visual-mode #visual-mode #text-objects #editing #selection #productivity
v:count1
The v:count1 variable holds the count typed before a command, defaulting to 1 if no count was given.
\@<=pattern
The \@<= atom is a positive lookbehind in Vim regex.
:e scp://user@host//path/to/file
Vim's built-in netrw plugin supports editing files over the network using protocols like SCP, SFTP, and HTTP.
:'<,'>center
After making a visual selection, typing : automatically inserts ' to scope the command to the selection.
visual-mode #visual-mode #formatting #ex-commands #indentation
= (in visual mode)
After making a visual selection, pressing = applies Vim's auto-indent to every selected line at once.
<C-a> in insert mode
Pressing while in insert mode inserts the same text that was typed during the previous insert mode session.
:tabmove {n}
:tabmove {n} repositions the current tab page to index n in the tab bar (0-indexed from the left).
<C-w>g]
g] splits the window and then runs :tselect for the identifier under the cursor, displaying a numbered list of all matching tags so you can pick the exact defin