How do I move to the end of the visible screen line when text is soft-wrapped?
g$
The g$ command moves the cursor to the last character of the current screen line, not the end of the logical line.
795 results for "G"
g$
The g$ command moves the cursor to the last character of the current screen line, not the end of the logical line.
:%s/\s\+/ /g
The pattern \s\+ matches one or more whitespace characters (spaces, tabs).
:s/old/new/g
The :s/old/new/g command replaces all occurrences of old with new on the current line only.
:%s/\v(\d+)/\=printf('%04d', submatch(1))/g
When you need stable-width numeric fields, manual edits are slow and error-prone.
command-line #command-line #substitution #regex #refactoring
:'<,'>g/let /normal! A;<CR>
When you need a structural edit in part of a file, Visual mode ranges combine well with :global and :normal!.
visual-mode #visual-mode #command-line #ex-commands #editing
:%s/pattern/\=expr/g
Prefixing the replacement field of :s with \= tells Vim to evaluate the rest as a Vimscript expression and use its result as the replacement string.
:%s/\v<(\w+)\s+\1>/\1/g\<CR>
OCR cleanup, copy-paste artifacts, and rushed note-taking often produce repeated words like the the or is is.
:%s/\n\{3,}/\r\r/g
When files pass through formatters, generators, or repeated edits, they often accumulate noisy vertical gaps.
:%s/\d\+/\=printf('%04d', submatch(0))/g
When you need fixed-width numeric fields, manually editing each number is slow and error-prone.
:%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
:g/^./,/^$/join
The :g/^.
command-line #command-line #editing #global #formatting #paragraphs
<C-g>U{motion}
By default, moving the cursor with arrow keys while in insert mode creates an undo break — meaning a subsequent u will undo only back to when you last moved,
:%Subvert/old/new/g
The vim-abolish plugin by Tim Pope provides the :Subvert command (abbreviated :S), which performs search-and-replace operations that automatically handle every
:g/pattern/normal A;
The :global command combined with :normal lets you execute arbitrary normal mode keystrokes on every line that matches a pattern.
command-line #global #normal-mode #editing #ex-commands #batch-editing
:keeppattern s/old/new/g
When you run a :s or :g command, Vim updates the search register (@/) with the pattern you used.
:g/pattern/m $
The :g (global) command combined with :m (move) lets you collect all lines matching a pattern and relocate them to a specific position in the file.
command-line #ex-commands #editing #global #search #formatting
:%s/\vfoo\zsbar/baz/g
When your match has a stable prefix but you only want to replace the trailing segment, \zs is often cleaner than introducing extra capture groups.
:%s/\v\d+/\=printf('%04d', submatch(0))/g
When you need aligned numeric data for logs, IDs, or generated fixtures, manual edits are slow and error-prone.
:[range]g/pattern/command
The :global command accepts an optional line range prefix that restricts which lines it even considers matching.
:let g:netrw_liststyle=3
Vim ships with a built-in file browser called netrw, opened with :Explore (or :Ex).