You may have noticed that this command replaced 5 characters in the line with
twelve others. The «R» command automatically extends the line if it runs out
of characters to replace. It will not continue on the next line.
You can switch between Insert mode and Replace mode with the
When you use
old text is put back. Thus it works like an undo command for the last typed
The operators, movement commands and text objects give you the possibility to
make lots of combinations. Now that you know how it works, you can use N
operators with M movement commands to make N * M commands!
You can find a list of operators here: |operator|
For example, there are many other ways to delete pieces of text. Here are a
few often used ones:
x delete character under the cursor (short for «dl»)
X delete character before the cursor (short for «dh»)
D delete from cursor to end of line (short for «d$»)
dw delete from cursor to next start of word
db delete from cursor to previous start of word
diw delete word under the cursor (excluding white space)
daw delete word under the cursor (including white space)
dG delete until the end of the file
dgg delete until the start of the file
If you use «c» instead of «d» they become change commands. And with «y» you
yank the text. And so forth.
There are a few often used commands to make changes that didn’t fit somewhere
~ change case of the character under the cursor, and move the
cursor to the next character. This is not an operator (unless
’tildeop’ is set), thus you can’t use it with a motion
command. It does work in Visual mode and changes case for
all the selected text then.
I Start Insert mode after moving the cursor to the first
non-blank in the line.
A Start Insert mode after moving the cursor to the end of the