How do I use marks to define a range for Ex commands?
:'a,'b s/old/new/g
Marks can be used as range specifiers in any Ex command.
command-line #marks #command-line #ex-commands #ranges #editing
399 results for "it at"
:'a,'b s/old/new/g
Marks can be used as range specifiers in any Ex command.
command-line #marks #command-line #ex-commands #ranges #editing
<C-o> (in insert mode)
Pressing while in insert mode drops you into a special "insert-normal" mode where you can execute exactly one normal mode command, then immediately return to in
:lockmarks
Many Ex commands silently adjust or delete marks as a side effect of modifying buffer content.
[{ / ]}
When editing code inside a deeply nested block, [{ jumps backward to the unmatched { that encloses the current position, and ]} jumps forward to its matching }.
:syntime on
When Vim feels sluggish while editing files with complex syntax highlighting, :syntime lets you profile exactly which syntax rules are consuming the most time.
gq (visual mode)
Pressing gq on a visual selection reformats the selected lines to hard-wrap at textwidth columns.
O in visual block mode
In visual block mode (), pressing O (uppercase) moves the cursor to the diagonally opposite corner of the rectangular selection.
{ and }
The { and } commands move the cursor by paragraph — jumping to the previous or next blank line.
:set statusline=%f\ %y\ [%l/%L]
Vim's statusline option lets you build a custom status bar from format items.
<C-t> / <C-d>
While in Insert mode, you can adjust indentation without switching back to Normal mode.
:argdo normal @q | update
The :argdo command runs a command in every file in the argument list.
macros #macros #batch-editing #multi-file #ex-commands #workflow
iabbrev
:iabbrev defines insert-mode abbreviations that expand automatically when you type a non-keyword character (space, punctuation, ) after the abbreviation.
:helpgrep {pattern}
:helpgrep searches the full text of every Vim help file for a pattern and loads all matches into the quickfix list.
:vimgrep /pattern/j **/*
By default, :vimgrep jumps your cursor to the first match it finds, which can be disorienting when you just want to collect results and browse them on your own
"-
Vim silently stores every deletion of less than one line in the special "- register (the "small delete" register).
H
The H command moves the cursor to the first line of the currently visible screen (the "High" position).
<C-w>gf
gf reads the filename under the cursor and opens it in a new tab page, keeping your current buffer untouched.
<C-w>f
How it works You may already know that gf opens the file path under the cursor in the current window.
:<C-r>a
How it works While typing an Ex command on the command line (after pressing :), you can insert the contents of any register by pressing Ctrl-R followed by the r
:%s/\%Vpattern/replacement/g
The \%V atom restricts a regex match to the last visual selection — more precisely than :'s/.