How do I wrap text with an HTML tag using vim-surround?
ysiw<em>
The vim-surround plugin makes wrapping text in HTML or XML tags effortless.
432 results for "visual mode"
ysiw<em>
The vim-surround plugin makes wrapping text in HTML or XML tags effortless.
packadd matchit
Vim ships with matchit.
gI
Most Vim users know I to insert at the start of a line — but I actually jumps to the first non-blank character, skipping leading whitespace.
gw
The gw operator reformats text to fit within textwidth, just like gq — but with one key difference: gw leaves the cursor in its original position after format
!{motion}{command}
The ! operator filters the text covered by a motion through an external shell command, replacing the original lines with the command's stdout.
:s/\v\w+/\U&/g
Vim's substitute command supports special case-conversion sequences in the replacement string, letting you transform matched text to upper or lower case without
:s/old/new/g
The :s/old/new/g command replaces all occurrences of old with new on the current line only.
:s/\v(\S+)\s*=\s*(.*)/\=printf('%-20s = %s', submatch(1), submatch(2))/
When a line contains uneven key = value spacing, quick manual fixes are easy to get wrong.
:t {address}
How it works The :t command (short for :copy) copies one or more lines and places them below the specified address.
:/pattern/+N and :/pattern/-N
Vim's Ex command ranges can use search patterns as line addresses, and those addresses can include a numeric offset (+N or -N) to target lines relative to the m
set statusline=%{MyCustomFunc()}
How it works Vim's statusline supports the %{expr} syntax which evaluates a Vimscript expression and displays the result.
:nnoremap <buffer> <leader>r :!python %<CR>
How it works By adding to a mapping command, the mapping only applies to the current buffer.
g- and g+
Vim's undo history is a tree, not a linear stack.
:set keywordprg=:help
By default, pressing K in Normal mode runs the word under the cursor through an external program — usually man.
:norm
:normal (abbreviated :norm) executes a sequence of normal-mode keystrokes on each line of an address range.
qa:s/old/new/g<CR>jq
How it works You can combine Ex commands like :s (substitute) with macro recording to create powerful repeatable find-and-replace operations that go beyond what
:t
The :t command (short for :copy) copies addressed lines to a destination line number, leaving the unnamed register untouched.
g+ and g-
Vim's undo history is a tree, not a linear stack.
:{range} normal @{reg}
The :normal command lets you execute Normal mode keystrokes over a range of lines.
<C-a> / <C-x> (vim-speeddating)
vim-speeddating (by Tim Pope) extends Vim's built-in and increment/decrement operators to understand dates, times, roman numerals, and other ordered sequences.