Next: Last line mode commands
Up: The vi editor
Previous: Switching between modes
The italic n stands for a positive integer in the commands below. If it is not specified, then default value is 1.
- Moving around the text
- nl or right arrow: move the cursor n character right.
- nh or left arrow: move the cursor n character left.
- nj or down arrow: move the cursor n line down. (cursor will be at the same column if line is long enough. If new line is short, cursor goes to the end of that line.
- nk or up arrow: move the cursor n line up.
- nw: move the cursor to the start of n next word.
- nb: move the cursor to the start of n previous word.
- ne: move the cursor to the end of the n next word.
-
$
: move the cursor to the last character of current line.
-
^
(caret): move the cursor to the first character of current line.
-
%
: show the matching parenthesis of current parenthesis.
- Inserting text (once you press one of these keys, you go to insert mode.)
- a: append after cursor.
- A: append after end of current line.
- i: insert before cursor.
- I: insert before beginning of current line.
- o: open new line below current line and insert to new line.
- O: open new line above current line and insert to new line.
- Deleting text
- nx: delete n characters beginning from current character.
- nX: delete previous n characters.
- ndw: delete next n words beginning with current.
- ndb: delete previous n words.
- ndd: delete n lines beginning with current line. Puts the deleted lines to buffer.
- D: delete from cursor to end of current line.
- Copying and placing text
- nyy : Yank n lines to buffer.
- p : Put yanked text before cursor; also puts last deleted text.
Next: Last line mode commands
Up: The vi editor
Previous: Switching between modes