Here are some basic operators, these are combined with motions to edit text:
: Yank (copy)
: Put (paste)
: Change, deletes and enters INSERT mode
p paste with something highlighted to replace the highlighted section. This is extremely helpful, since deleting an item can change what is in your register you are trying to paste. See Registers for more.
Undo / Redo
u for undo, and
ctrl-r for redo. No motion required, just press the keys in NORMAL or VISUAL mode.
Uppercase & Lowercase
: Lowercase test
: Uppercase text
: Toggle text case
gu_ will switch the current line to lowercase, or
g~_ will toggle the case of each character on the current line.
:help shift-left-right The brackets
> will shift the line one
shiftwidth length to the left, or right. These can also be paired with VISUAL mode, ranges, and motions.
For example, use
shift-v to select a line, use arrows or other motions to expand the range, and then type
> to shift the lines.
>> to shift using a count. For example,
5>> will shift 5 lines once to the right. If you want to shift more use
. to repeat the command.
:help = The
= command will indent text based on internal formatting rules, or as defined by a plugin for the language. The typical way I use is to highlight the section I want to format using VISUAL mode, and then press
= to format.
. to repeat the last command.
If you start with a number, and then type a command, Vim executes the command that many times. For example, if you want to delete three lines, type
Single Character Operators
: Replace character under cursor with
: Delete character under cursor
: Toggle case for character under cursor