Nvim :help
pages, generated
from source
using the tree-sitter-vimdoc parser.
reference
<Help>
or <F1>
key and with the
:help command (just type ":help", without the bars or quotes).
The 'helpfile' option can be set to the name of the help file, in case it
is not located in the default place. You can jump to subjects like with tags:
Use CTRL-]
to jump to a subject under the cursor, use CTRL-T
to jump back.pronounce
Vim is pronounced as one word, like Jim. So Nvim is "En-Vim", two syllables.book
There are many books on Vi and Vim. We recommend:love
peace
friendship
gross-national-happiness
Vi
vi
Vi "the original". Without further remarks this is the version
of Vi that appeared in Sun OS 4.x. ":version" returns
"Version 3.7, 6/7/85". Source code only available with a license.
Nvi
Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.
Very good compatibility with the original Vi, with a few extensions.
The version used is 1.79. ":version" returns "Version 1.79
(10/23/96)". Source code is freely available.
Elvis
Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't
as flexible as Vim. Source code is freely available.CTRL-X
.count
[count]
[count] An optional number that may precede the command to multiply
or iterate the command. If no number is given, a count of one
is used, unless otherwise noted. Note that in this manual the
[count] is not mentioned in the description of the command,
but only in the explanation. This was done to make the
commands easier to look up. If the 'showcmd' option is on,
the (partially) entered count is shown at the bottom of the
window. You can use <Del>
to erase the last digit (N<Del>).[quotex]
["x] An optional register designation where text can be stored.
See registers. The x is a single character between 'a' and
'z' or 'A' and 'Z' or '"', and in some cases (with the put
command) between '0' and '9', '%', '#', or others. The
uppercase and lowercase letter designate the same register,
but the lowercase letter is used to overwrite the previous
register contents, while the uppercase letter is used to
append to the previous register contents. Without the ""x" or
with """" the stored text is put into the unnamed register.{}
{} Curly braces denote parts of the command which must appear,
but which can take a number of different values. The
differences between Vim and Vi are also given in curly braces
(this will be clear from the context).{char1-char2}
{char1-char2}
A single character from the range char1 to char2. For
example: {a-z}
is a lowercase letter. Multiple ranges may be
concatenated. For example, {a-zA-Z0-9}
is any alphanumeric
character.{motion}
movement
{motion}
A command that moves the cursor. These are explained in
motion.txt. Examples:
w to start of next word
b to begin of current word
4j four lines down
/The<CR> to next occurrence of "The"
This is used after an operator command to move over the text
that is to be operated upon.
{Visual}
{Visual}
A selected text area. It is started with the "v", "V", or
CTRL-V
command, then any cursor movement command can be used
to change the end of the selected text.
This is used before an operator command to highlight the
text that is to be operated upon.
See Visual-mode.<character>
<character>
A special character from the table below, optionally with
modifiers, or a single ASCII character with modifiers.'character'
'c' A single ASCII character.CTRL-{char}
CTRL-{char}
{char}
typed as a control character; that is, typing {char}
while holding the CTRL key down. The case of {char}
is
ignored; thus CTRL-A
and CTRL-a
are equivalent. But in
some terminals and environments, using the SHIFT key will
produce a distinct code (e.g. CTRL-SHIFT-a
); in these
environments using the SHIFT key will not trigger commands
such as CTRL-A
.'option'
'option' An option, or parameter, that can be set to a value, is
enclosed in single quotes. See options.quotecommandquote
"command" A reference to a command that you can type is enclosed in
double quotes.
command
New style command, this distinguishes it from other quoted
text and strings.key-notation
key-codes
keycodes
These names for keys are used in the documentation. They can also be used
with the ":map" command.<Nul>
zero CTRL-@
0 (stored as 10) <Nul>
<BS>
backspace CTRL-H
8 backspace
<Tab>
tab CTRL-I
9 tab
Tab
linefeed
<NL>
linefeed CTRL-J
10 (used for <Nul>
)
<CR>
carriage return CTRL-M
13 carriage-return
<Return>
same as <CR>
<Return>
<Enter>
same as <CR>
<Enter>
<Esc>
escape CTRL-[
27 escape
<Esc>
<Space>
space 32 space
<lt>
less-than < 60 <lt>
<Bslash>
backslash \ 92 backslash
<Bslash>
<Bar>
vertical bar | 124 <Bar>
<Del>
delete 127
<CSI>
command sequence intro ALT-E
sc 155 <CSI>
<EOL>
end-of-line (can be <CR>
, <NL>
or <CR>
<NL>
,
depends on system and 'fileformat') <EOL>
<Ignore>
cancel wait-for-character <Ignore>
<NOP>
no-op: do nothing (useful in mappings) <Nop>
<Up>
cursor-up cursor-up
cursor_up
<Down>
cursor-down cursor-down
cursor_down
<Left>
cursor-left cursor-left
cursor_left
<Right>
cursor-right cursor-right
cursor_right
<S-Up>
shift-cursor-up
<S-Down>
shift-cursor-down
<S-Left>
shift-cursor-left
<S-Right>
shift-cursor-right
<C-Left>
control-cursor-left
<C-Right>
control-cursor-right
<F1>
- <F12>
function keys 1 to 12 function_key
function-key
<S-F1>
- <S-F12>
shift-function keys 1 to 12 <S-F1>
<Help>
help key
<Undo>
undo key
<Insert>
insert key
<Home>
home home
<End>
end end
<PageUp>
page-up page_up
page-up
<PageDown>
page-down page_down
page-down
<kUp>
keypad cursor-up keypad-cursor-up
<kDown>
keypad cursor-down keypad-cursor-down
<kLeft>
keypad cursor-left keypad-cursor-left
<kRight>
keypad cursor-right keypad-cursor-right
<kHome>
keypad home (upper left) keypad-home
<kEnd>
keypad end (lower left) keypad-end
<kOrigin>
keypad origin (middle) keypad-origin
<kPageUp>
keypad page-up (upper right) keypad-page-up
<kPageDown>
keypad page-down (lower right) keypad-page-down
<kDel>
keypad delete keypad-delete
<kPlus>
keypad + keypad-plus
<kMinus>
keypad - keypad-minus
<kMultiply>
keypad * keypad-multiply
<kDivide>
keypad / keypad-divide
<kPoint>
keypad . keypad-point
<kComma>
keypad , keypad-comma
<kEqual>
keypad = keypad-equal
<kEnter>
keypad Enter keypad-enter
<k0>
- <k9>
keypad 0 to 9 keypad-0
keypad-9
<S-…>
shift-key shift
<S-
<C-…>
control-key control
ctrl
<C-
<M-…>
alt-key or meta-key META
ALT
<M-
<A-…>
same as <M-…>
<A-
<T-…> meta-key when it's not alt <T-
<D-…>
command-key or "super" key <D-
<Help>
, <S-Right>
, …) depends on the UI or host
terminal.
<k0>
,
<k1>
, ..., <k9>
and <kPoint>
will not work.
<M-ä>
. Which
combinations actually work depends on the UI or host terminal.
<Esc>
was pressed before the key.
<M-C-T>
for CTRL-A
LT-T),
but your terminal must encode the input for that to work. tui-input
<>
Examples are often given in the <> notation. Sometimes this is just to make
clear what you need to type, but often it can be typed literally, e.g., with
the ":map" command. The rules are:
1. Printable characters are typed directly, except backslash and "<"
2. Backslash is represented with "\\", double backslash, or "<Bslash>".
3. Literal "<" is represented with "\<" or "<lt>". When there is no
confusion possible, "<" can be used directly.
4. "<key>" means the special key typed (see the table above). Examples:
<Esc>
Escape key
<C-G>
CTRL-G
<Up>
cursor up key
<C-LeftMouse>
Control- left mouse click
<S-F11>
Shifted function key 11
<M-a>
Meta- a ('a' with bit 8 set)
<M-A>
Meta- A ('A' with bit 8 set)<lt>
to escape the special meaning of key names. Using a
backslash also works, but only when 'cpoptions' does not include the 'B' flag.CTRL-H
to the six characters "<Home>"::imap <C-H> \<Home>
:imap <C-H> <lt>Home>
The first one only works when the 'B' flag is not in 'cpoptions'. The second
one always works.
To get a literal "<lt>" in a mapping::map <C-L> <lt>lt>
The notation can be used in a double quoted strings, using "\<" at the start,
e.g. "\<C-Space>". This results in a special key code. To convert this back
to readable text use keytrans()
.Normal
Normal-mode
command-mode
Normal mode In Normal mode you can enter all the normal editor
commands. If you start the editor you are in this
mode. This is also known as command mode.Terminal-mode
Terminal mode In Terminal mode all input (except CTRL-\
) is sent to
the process running in the current terminal buffer.
If CTRL-\
is pressed, the next key is sent unless it
is CTRL-N
(CTRL-\_CTRL-N) or CTRL-O
(t_CTRL-\_CTRL-O).
If the 'showmode' option is on "-- TERMINAL --" is shown
at the bottom of the window.Operator-pending
Operator-pending-mode
Operator-pending mode This is like Normal mode, but after an operator
command has started, and Vim is waiting for a {motion}
to specify the text that the operator will work on.CTRL-O
is typed in Insert mode (see
i_CTRL-O). This is like Normal mode, but after
executing one command Vim returns to Insert mode.
If the 'showmode' option is on "-- (insert) --" is
shown at the bottom of the window.CTRL-O
and then "v", "V" or
CTRL-V
. When the Visual selection ends, Vim returns
to Insert mode.
If the 'showmode' option is on "-- (insert) VISUAL --"
is shown at the bottom of the window.<S-Right>
.
When the Select mode ends, Vim returns to Insert mode.
If the 'showmode' option is on "-- (insert) SELECT --"
is shown at the bottom of the window.<Esc>
twice. This doesn't work for Ex mode
though, use ":visual".
You will know you are back in Normal mode when you see the screen flash or
hear the bell after you type <Esc>
. However, when pressing <Esc>
after using
CTRL-O in Insert mode you get a beep but you are still in Insert mode, type
<Esc>
again.i_esc
Normal v V ^V *4 *1 R gR : / ? ! Q Visual *2 ^G c C -- : -- Select *5 ^O ^G *6 -- -- -- Insert <Esc> -- -- <Insert> -- -- Replace <Esc> -- -- <Insert> -- -- Command-line `*3` -- -- :start -- -- Ex :vi -- -- -- -- ---- not possible
<Esc>
"v", "V" or "CTRL-V"
(see v_v), which just stops Visual mode without side effects.
* 3 Go from Command-line mode to Normal mode by:
<CR>
or <NL>
, which causes the entered command to be executed.
CTRL-U
) and giving a final <BS>
.
CTRL-C
or <Esc>
, which quits the command-line without executing
the command.
In the last case <Esc>
may be the character defined with the 'wildchar'
option, in which case it will start command-line completion. You can
ignore that and type <Esc>
again.
* 4 Go from Normal to Select mode by:
CTRL-H
" g_CTRL-H
* 5 Go from Select mode to Normal mode by using a non-printable command to move
the cursor, without keeping the Shift key pressed.
* 6 Go from Select mode to Insert mode by typing a printable character. The
selection is deleted and the character is inserted.
CTRL-\_CTRL-N
i_CTRL-\_CTRL-N
c_CTRL-\_CTRL-N
v_CTRL-\_CTRL-N
t_CTRL-\_CTRL-N
Additionally the command CTRL-\
CTRL-N
or <C-\>
<C-N>
can be used to go to
Normal mode from any other mode. This can be used to make sure Vim is in
Normal mode, without causing a beep like <Esc>
would. However, this does not
work in Ex mode. When used after a command that takes an argument, such as
f or m, the timeout set with 'ttimeoutlen' applies.CTRL-\_CTRL-G
i_CTRL-\_CTRL-G
c_CTRL-\_CTRL-G
v_CTRL-\_CTRL-G
CTRL-\
CTRL-G
works the same as CTRL-\_CTRL-N for backward compatibility.gQ
mode-Ex
Ex-mode
Ex
EX
E501
gQ Switch to Ex mode. This is like typing ":" commands
one after another, except:
:vi
command (:visual) to exit this mode.
+-----------------------+ |some line | |last line | |~ | |~ | +-----------------------+
+-----------------------+ |first line | |second line | |@ | |@ | +-----------------------+
+-----------------------+ |first line | |second line | |a very long line that d| |oesn't fit in the wi@@@| +-----------------------+
wrap-off
If the 'wrap' option is off, long lines will not wrap. Only the part that
fits on the screen is shown. If the cursor is moved to a part of the line
that is not shown, the screen is scrolled horizontally. The advantage of
this method is that columns are shown as they are and lines that cannot fit
on the screen can be edited. The disadvantage is that you cannot see all the
characters of a line at once. The 'sidescroll' option can be set to the
minimal number of columns to scroll.<Tab>
is replaced with the number of spaces that it represents. Other non-printing
characters are replaced with "^{char}", where {char}
is the non-printing
character with 64 added. Thus character 7 (bell) will be shown as "^G".
Characters between 127 and 160 are replaced with "~{char}", where {char}
is
the character with 64 subtracted. These characters occupy more than one
position on the screen. The cursor can only be positioned on the first one.<Tab>
characters will not be shown as several
spaces, but as "^I". A '$' will be placed at the end of the line, so you can
find trailing blanks.+-------------------------------+ screen | window 1 | window 2 | | | | | | | |= status line =|= status line =| | window 3 | | | | | |==== status line ==============| |command line | +-------------------------------+