w
is until the start of the next word, excluding its first character.e
is until the end of the current word, including the last character.
- In the command
dd
, the secondd
isn't a motion. It's just a shortcut by the vim designers.
- Typing a capital
U
will undo all changes on a line. - Typing
Ctrl
+R
will redo the commands, or undo the undos.
- To change until the end of a word, type
ce
.
- The change operator accepts a number and a motion like
d
.
- Typing
Ctrl
+g
will display the filename and the position in the file. - Typing
gg
will move to the start of a file, and typingG
moves to the bottom.
- Typing
Ctrl
+o
will jump to an older location. TypingCtrl
+i
will jump to a newer location.
- To substitute only on the current line, type
:s/old/new
. - To substitute in a range of lines, type
:#,#s/old/new/g
. - To find each occurrence and prompt for substitution, type
:%s/old/new/gc
.
- To save part of a file, select it in visual mode before executing
:w
.
- To insert the contents of a file, type
:r FILENAME
.
- Type
R
to replace more than one character.
- You can also use
y
as an operator, e.g.yw
yanks one word.
- If you want to ignore case for just one search command, use `/[term]\c.
- Type
:help
to get help. Add an argument to get help on a particular subject.
- Tab completion works for commands, as well as filenames following
:e
or:w
.