How do I append the same suffix to every selected line in Visual mode?
:'<,'>normal! A;
Visual selections are not just for direct operators; they also define an Ex range.
visual-mode #visual-mode #normal-mode #editing #ex-commands #automation
Search Vim Tricks
Searching...:'<,'>normal! A;
Visual selections are not just for direct operators; they also define an Ex range.
visual-mode #visual-mode #normal-mode #editing #ex-commands #automation
:keepmarks {command}
Many batch edits in Vim update special marks like '[ and '], which can disrupt follow-up motions or tooling that depends on those positions.
navigation #navigation #marks #command-line #refactoring #editing
/\S\zs\s\+$
A plain trailing-whitespace search like /\s\+$ also matches fully blank lines, which is noisy when you only want accidental spaces after real content.
:packadd cfilter
Vim ships with useful optional runtime plugins that many users never load.
plugins #plugins #quickfix #location-list #search #command-line
:set viewoptions-=options
When you use :mkview and :loadview, Vim stores more than folds and cursor position.
:let @a = expand('%:p')
Named registers are not only for yanked text.
registers #registers #command-line #filename-modifiers #editing
,
After using f, t, F, or T for single-character motion on a line, Vim lets you repeat that character search without retyping the target.
:set eadirection=hor
If you use many splits, automatic equalization can feel disruptive when Vim resizes both height and width after layout changes.
%:S
When you build shell commands from Vim, file paths with spaces or special characters can break the command unless properly escaped.
command-line #command-line #filename-modifiers #shell #expansion
:set wrapscan!
wrapscan controls what happens when a / or ? search reaches the end (or beginning) of the file.
]`
Most users jump to marks directly ('a, ` a `), but when a file has many lowercase marks, stepping through them in order is faster than remembering each name.
:argdedupe
If you build an arglist incrementally (:args, :argadd, glob expansions), duplicates can sneak in and make :argdo workflows slower or confusing.
command-line #command-line #arglist #batch-editing #workflow
:filter /pattern/ ls
When you have many open buffers, plain :ls output gets noisy fast.
g?iw
g? is Vim’s built-in ROT13 operator.
:set completeopt=menuone,noinsert,noselect
When completion inserts text too early, you lose control over what gets committed and where undo breakpoints land.
:call setreg('a', "foo\nbar", 'b')
Most register examples focus on interactive yanks, but setreg() lets you construct registers programmatically, including their type.
:keepjumps normal! 500@q
Running a macro hundreds of times is efficient, but it can flood your jumplist and make normal navigation painful afterward.
/\%>80v\S
When you enforce line-length limits, visual guides show where the boundary is, but they do not help you jump directly to violations.
:%s/#\zs\d\+/\=printf('%04d', submatch(0))/g
For log files, changelogs, or issue references, you sometimes need fixed-width numeric IDs without touching surrounding syntax.
editing #editing #ex-commands #substitute #regex #text-processing
:/BEGIN/,/END/-1s/\s\+$//
When you need to clean or refactor block-like regions, Ex ranges can target lines between two search patterns without selecting text manually.
command-line #command-line #ex-commands #ranges #search #editing