|ins-special-special|
The arrow keys can be used in insert mode to move around in the file.
This breaks the insert in two parts as far as undo and redo is
concerned.
CTRL-O can be used to execute a single Normal mode command. This is
almost the same as hitting <Esc>, typing the command and doing |a|.
Visual mode. |Visual-mode|
Visual mode can be used to first highlight a piece of text and then
give a command to do something with it. This is an (easy to use)
alternative to first giving the operator and then moving to the end of
the text to be operated upon.
|v| and |V| are used to start Visual mode. |v| works on characters
and |V| on lines. Move the cursor to extend the Visual area. It is
shown highlighted on the screen. By typing "o" the other end of the
Visual area can be moved. The Visual area can be affected by an
operator:
d delete
c change
y yank
> or < insert or delete indent
! filter through external program
= filter through indent
: start |:| command for the Visual lines.
gq format text to 'textwidth' columns
J join lines
~ swap case
u make lowercase
U make uppercase
Block operators. |visual-block|
With Visual mode a rectangular block of text can be selected. Start
Visual mode with CTRL-V. The block can be deleted ("d"), yanked ("y")
or its case can be changed ("~", "u" and "U"). A deleted or yanked
block can be put into the text with the "p" and "P" commands.
Help system. |:help|
Help is displayed in a window. The usual commands can be used to
move around, search for a string, etc. Tags can be used to jump
around in the help files, just like hypertext links. The |:help|
command takes an argument to quickly jump to the info on a subject.
<F1> is the quick access to the help system. The name of the help
index file can be set with the 'helpfile' option.
Command-line editing and history. |cmdline-editing|
You can insert or delete at any place in the command-line using the
cursor keys. The right/left cursor keys can be used to move
forward/backward one character. The shifted right/left cursor keys
can be used to move forward/backward one word. CTRL-B/CTRL-E can be
used to go to the begin/end of the command-line.
(Vi: can only alter the last character in the line)
(Vi: when hitting <Esc> the command-line is executed. This is
unexpected for most people; therefore it was changed in Vim. But when
the <Esc> is part of a mapping, the command-line is executed. If you
want the Vi behaviour also when typing <Esc>, use ":cmap ^V<Esc>
^V^M")
|cmdline-history|
The command-lines are remembered. The up/down cursor keys can be used
to recall previous command-lines. The 'history' option can be set to
the number of lines that will be remembered. There is a separate
history for commands and for search patterns.
Command-line completion. |cmdline-completion|
While entering a command-line (on the bottom line of the screen)
<Tab> can be typed to complete
what example ~
- command :e<Tab>
- tag :ta scr<Tab>
- option :set sc<Tab>
- option value :set hf=<Tab>
- file name :e ve<Tab>
- etc.
If there are multiple matches, CTRL-N (next) and CTRL-P (previous)
will walk through the matches. <Tab> works like CTRL-N, but wraps
around to the first match.
The 'wildchar' option can be set to the character for command-line
completion, <Tab> is the default. CTRL-D can be typed after an
(incomplete) wildcard; all matches will be listed. CTRL-A will insert
all matches. CTRL-L will insert the longest common part of the
matches.
Insert-mode completion. |ins-completion|
In Insert mode the CTRL-N and CTRL-P keys can be used to complete a
word that appears elsewhere. |i_CTRL-N|
With CTRL-X another mode is entered, through which completion can be
done for:
|i_CTRL-X_CTRL-F| file names
|i_CTRL-X_CTRL-K| words from 'dictionary' files
|i_CTRL-X_CTRL-T| words from 'thesaurus' files
|i_CTRL-X_CTRL-I| words from included