Skip to content

Roadmap

✅ Implemented

⭐ Sublime Text specific; Non-Vim behaviour

[count] An optional number that may precede the command to multiply or iterate the command.

Vim reference: https://vimhelp.org

Table of Contents (click to expand)

Modes

ModeDescription
Insert mode[count]i
Normal mode<Esc>, CTRL-[, CTRL-c
Visual modev
Visual line mode[count]V
Visual block modeCTRL-v
Replace modeR
Replace mode[count]R #1005
Operator‑pending modeLike Normal mode, but after an operator command has start, and Vim is waiting for a {motion} to specify the text that the operator will work on.
Command-line mode
Cmdline mode
:, /, ?, !
Multiple-cursor modeCTRL-n, gh

About using the help files

CommandDescription
:h[elp]Open a window and display the help file in read-only mode.
:h[elp] {subject}Like ":help", additionally jump to the tag {subject}. Example: :help options

Editing and writing files

1. Introduction

CommandDescription
CTRL-G
:f[ile]
Prints the current file name.
:buffers
:files
:ls
List all the currently known file names. Multiple cursors are presented as a comma-delimited list of line numbers.
:e[dit]Edit the current file. This is useful to re-edit the current file, when it has been changed outside of Sublime.
:e[dit]!Edit the current file always. Discard any changes to the current buffer. This is useful if you want to start all over again.
:e[dit] {file}Edit {file}.
:ene[w]Edit a new, unnamed buffer.
CTRL-^Edit the alternate file. Mostly the alternate file is the previously edited file. This is a quick way to toggle between two files. It is equivalent to ":e #", except that it also works when there is no file name. Mostly the ^ character is positioned on the 6 key, pressing CTRL and 6 then gets you what we call CTRL-^. But on some non-US keyboards CTRL-^ is produced in another way.
gfEdit the file whose name is under or after the cursor. Mnemonic: "goto file". For Unix the '~' character is expanded, like in "~user/file". Environment variables are expanded too.
{Visual}gfSame as "gf", but the highlighted text is used as the name of the file to edit. Leading blanks are skipped, otherwise all blanks and special characters are included in the file name. (For {Visual} see Visual-mode.).
gFSame as "gf", except if a number follows the file name, then the cursor is positioned on that line in the file. The file name and the number must be separated by a non-filename and non-numeric character. White space between the filename, the separator and the number are ignored. Examples: eval.c:10, eval.c:10:42, eval.c@20, eval.c(30).
{Visual}gFSame as "v_gf".

4. Writing

CommandDescription
:w[rite]Write the whole buffer to the current file. This is the normal way to save changes to a file.
:w[rite]!Like ":write", but forcefully write when there is another reason why writing was refused.
:w[rite] {file}Like ":write", but write to {file}.

WRITING WITH MULTIPLE BUFFERS

CommandDescription
:wa[ll]Write all changed buffers. Buffers without a file name cause an error message. Buffers which are readonly are not written.
:wa[ll]!Write all changed buffers, even the ones that are readonly. Buffers without a file name are not written and cause an error message.

5. Writing and quitting

CommandDescription
:q[uit]Quit the current window. Quit Sublime if this is the last view. See CTRL-W_q for quitting another window.
:q[uit]!Quit without writing, also when the current buffer has changes. Use ":qall!" to exit always.
:wqWrite the current file and close the window. If this was the last window Sublime quits. Writing fails when the file is read-only or the buffer does not have a name. Quitting fails when the last file in the argument list has not been edited.
:wq!Write the current file and close the window. If this was the last window Sublime quits. Writing fails when the current buffer does not have a name.
:wq {file}Write to {file} and close the window. If this was the last view Sublime quits. Quitting fails when the last file in the argument list has not been edited.
:wq! {file}Write to {file} and close the window. Quit Sublime if this was the last view.
:[range]wq[!]Same as above, but only write the lines in [range].
:[range]x[it][!] [file]Like ":wq", but write only when changes have been made.
:[range]exi[t][!] [file]Same as ":xit".
ZZWrite current file, if modified, and close the current window (same as ":x").
ZQQuit without checking for changes (same as ":q!").

MULTIPLE WINDOWS AND BUFFERS

CommandDescription
:qa[ll]Exit Vim, unless there are some buffers which have been changed.
:qa[ll]!Exit Vim. Any changes to buffers are lost.
:quita[ll][!]Same as ":qall".
:wqa[ll]
:xa[ll]
Write all changed buffers and exit Sublime. If there are buffers without a file name, which are readonly or which cannot be written for another reason, Sublime will not quit.
:wqa[ll]!
:xa[ll]!
Write all changed buffers, even the ones that are readonly, and exit Vim. If there are buffers without a file name or which cannot be written for another reason Sublime will not quit.

6. Dialogs

CommandDescription
:bro[wse]Open a file selection dialog.

7. The current directory

CommandDescription
:cd[!]Change the current directory to the home directory. Use :pwd to print the current directory.
:cd[!] {path}Change the current directory to {path}. To change to the directory of the current file: :cd %:h.
:pw[d]Print the current directory name.

Commands for moving around

1. Motions and operators

  • Vim reference: operator
CommandDescription
cchange
ddelete
yyank into register (does not change the text)
~swap case (only if 'tildeop' is set)
g~swap case
gumake lowercase
gUmake uppercase
!filter through an external program
=filter through 'equalprg' or C-indenting if empty
gqtext formatting
gwtext formatting with no cursor movement
g?ROT13 encoding
>shift right
<shift left
g@call function set with the 'operatorfunc' option

FORCING A MOTION TO BE LINEWISE, CHARACTERWISE OR BLOCKWISE

CommandDescription
vWhen used after an operator, before the motion command: Force the operator to work characterwise, also when the motion is linewise. If the motion was linewise, it will become exclusive.
If the motion already was characterwise, toggle inclusive/exclusive. This can be used to make an exclusive motion inclusive and an inclusive motion exclusive. #90
VWhen used after an operator, before the motion command: Force the operator to work linewise, also when the motion is characterwise. #90
CTRL-VWhen used after an operator, before the motion command: Force the operator to work blockwise. This works like Visual block mode selection, with the corners defined by the cursor position before and after the motion. #90

2. Left-right motions

  • Vim reference: left-right-motions
CommandDescription
h, <Left>, CTRL-H, <BS>[count] characters to the left.
l, <Right>, <Space>[count] characters to the right.
0To the first character of the line.
<Home>To the first character of the line.
^To the first non-blank character of the line.
$, <End>To the end of the line.
g_To the last non-blank character of the line and [count-1] lines downward.
g0, g<Home>When lines wrap ('wrap' on): To the first character of the screen line.
g^When lines wrap ('wrap' on): To the first non-blank character of the screen line.
gmLike "g0", but half a screen-width to the right (or as much as possible).
gMLike "g0", but to halfway the text of the line.
g$ or g<End>When lines wrap ('wrap' on): To the last character of the screen line and [count-1] screen lines downward.
|To screen column [count] in the current line.
f{char}To [count]'th occurrence of {char} to the right.
F{char}To the [count]'th occurrence of {char} to the left.
t{char}Till before [count]'th occurrence of {char} to the right.
T{char}Till after [count]'th occurrence of {char} to the left.
;Repeat latest f, t, F or T [count] times.
,Repeat latest f, t, F or T in opposite direction [count] times.

3. Up-down motions

  • Vim reference: up-down-motions
CommandDescription
k, <Up>, CTRL-P[count] lines upward.
j, <Down>, CTRL-J, <NL>, CTRL-N[count] lines downward.
gk, g<Up>[count] display lines upward.
gj, g<Down>[count] display lines downward.
-, <minus>[count] lines upward, on the first non-blank character.
+, CTRL-M, <CR>[count] lines downward, on the first non-blank character.
_, <underscore>[count] - 1 lines downward, on the first non-blank character.
GGoto line [count], default last line, on the first non-blank character.
<C-End>Goto line [count], default last line, on the last character.
<C-Home>, ggGoto line [count], default first line, on the first non-blank character.
:[range]Set the cursor on the last line number in [range].
{count}%Go to {count} percentage in the file, on the first non-blank in the line.
:[range]go[to] [count], [count]goGo to [count] byte in the buffer.

4. Word motions

  • Vim reference: word-motions
CommandDescription
w
<S-Right>
[count] words forward.
W
<C-Right>
[count] WORDS forward.
eForward to the end of word [count].
EForward to the end of WORD [count].
b
<S-Left>
[count] words backward.
B
<C-Left>
[count] WORDS backward.
geBackward to the end of word [count].
gEBackward to the end of WORD [count].

5. Text object motions

  • Vim reference: object-motions
CommandDescription
(a sentence backward.
)a sentence forward.
{[count] paragraphs backward.
}[count] paragraphs forward.
]][count] sections forward or to the next '{' in the first column. #32
][[count] sections forward or to the next '}' in the first column. #32
[[[count] sections backward or to the previous '{' in the first column. #32
[][count] sections backward or to the previous '}' in the first column. #32

6. Text object selection

  • Vim reference: text-objects
CommandDescription
aw"a word", select [count] words.
iw"inner word", select [count] words.
aW"a WORD", select [count] WORDs.
iW"inner WORD", select [count] WORDs.
as"a sentence".
is"inner sentence".
ap"a paragraph", select [count] paragraphs.
ip"inner paragraph", select [count] paragraphs.
a]
a[
"a [] block".
i]
i[
"inner [] block".
a)
a(
ab
"a block", select blocks, from "[(" to the matching ')', including the '(' and ')'.
i)
i(
ib
"inner block", select blocks, from "[(" to the matching ')', excluding the '(' and ')'.
a>
a<
"a <> block".
i>
i<
"inner <> block".
at"a tag block".
it"inner tag block".
a}
a{
aB
"a Block", select blocks, from "[{" to the matching '}', including the '{' and '}'.
i}
i{
iB
"inner block", select blocks, from "[{" to the matching '}', excluding the '{' and '}'.
a"
a'
a`
Selects the text from the previous quote until the next quote.
i"
i'
i`
Like a", a' and a`, but exclude the quotes.

7. Marks

  • Vim reference: mark-motions
CommandDescription
m{a-zA-Z}Set mark {a-zA-Z} at cursor position (does not move the cursor, this is not a motion command).
'{a-z}
`{a-z}
Jump to the mark {a-z} in the current buffer.
'{A-Z}
`{A-Z}
To the mark {A-Z} in the file where it was set (not a motion command when in another file).
:marksList all the current marks (not a motion command). The '(, '), '{ and '} marks are not listed. The first column has number zero.
:delm[arks] {marks}Delete the specified marks. Marks that can be deleted include A-Z and 0-9. You cannot delete the ' mark. They can be specified by giving the list of mark names, or with a range, separated with a dash. Spaces are ignored. Examples:
:delmarks a deletes mark a
:delmarks a b c deletes marks a, b and c
:delmarks Aa deletes marks A and a
:delmarks p-z deletes marks in the range p to z
:delm[arks]!Delete all marks for the current buffer, but not marks A-Z or 0-9.
''
``
To the position before the latest jump
'[
`[
To the first character of the previously changed or yanked text. #951
']
`]
To the last character of the previously changed or yanked text. #951

8. Jumps

  • Vim reference: jump-motions
CommandDescription
CTRL-oGo to [count] older cursor position in jump list (not a motion command).
<Tab>
CTRL-i
Go to [count] newer cursor position in jump list (not a motion command).

CHANGE LIST JUMPS

CommandDescription
g;Go to [count] older position in change list. If [count] is larger than the number of older change positions go to the oldest change. If there is no older change an error message is given. (not a motion command)
g,Go to [count] newer position in change list. Just like g; but in the opposite direction. (not a motion command)

9. Various motions

  • Vim reference: various-motions
CommandDescription
%Find the next item in this line after or under the cursor and jump to its match.
[(Go to previous unmatched '('.
[{Go to previous unmatched '{'.
])Go to next unmatched ')'.
]}Go to next unmatched '}'.
HTo the first line of the window on the first non-blank character. Cursor is adjusted for 'scrolloff' option, unless an operator is pending, in which case the text may scroll. E.g. "yH" yanks from the first visible line until the cursor line (inclusive).
MTo Middle line of window, on the first non-blank character.
LTo last line of the window on the first non-blank character. Cursor is adjusted for 'scrolloff' option, unless an operator is pending, in which case the text may scroll. E.g. "yL" yanks from the cursor to the last visible line.

Scrolling the text in the window

1. Scrolling downwards

The following commands move the edit window (the part of the buffer that you see) downwards (this means that more lines downwards in the text buffer can be seen):

CommandDescription
CTRL-EScroll window [count] lines downwards in the buffer. The text moves upwards on the screen. Mnemonic: Extra lines.
CTRL-DScroll window Downwards in the buffer. The number of lines comes from the 'scroll' option (default: half a screen). If [count] given, first set 'scroll' option to [count]. The cursor is moved the same number of lines down in the file (if possible; when lines wrap and when hitting the end of the file there may be a difference). When the cursor is on the last line of the buffer nothing happens and a beep is produced.
CTRL-F
<S-Down>
<PageDown>
Scroll window [count] pages Forwards (downwards) in the buffer.

2. Scrolling upwards

The following commands move the edit window (the part of the buffer that you see) upwards (this means that more lines upwards in the text buffer can be seen):

CommandDescription
CTRL-YScroll window [count] lines upwards in the buffer. The text moves downwards on the screen.
CTRL-UScroll window Upwards in the buffer. The number of lines comes from the 'scroll' option (default: half a screen). If [count] given, first set the 'scroll' option to [count]. The cursor is moved the same number of lines up in the file (if possible; when lines wrap and when hitting the end of the file there may be a difference). When the cursor is on the first line of the buffer nothing happens and a beep is produced.
<S-Up>, <PageUp>, CTRL-BScroll window [count] pages Backwards (upwards) in the buffer.

3. Scrolling relative to cursor

The following commands reposition the edit window (the part of the buffer that you see) while keeping the cursor on the same line.

NOTE

The 'scrolloff' option adds context lines above and below the cursor.

CommandDescription
z<CR>Redraw, line [count] at top of window (default cursor line). Put cursor at first non-blank in the line.
ztLike "z<CR>", but leave the cursor in the same column.
z{height}<CR>Redraw, make window {height} lines tall. This is useful to make the number of lines small when screen updating is very slow. Cannot make the height more than the physical screen height.
z.Redraw, line [count] at centre of window (default cursor line). Put cursor at first non-blank in the line.
zzLike "z.", but leave the cursor in the same column. Careful: If caps-lock is on, this command becomes "ZZ": write buffer and exit!
z-Redraw, line [count] at bottom of window (default cursor line). Put cursor at first non-blank in the line.
zbLike "z-", but leave the cursor in the same column.

4. Scrolling horizontally

For the following four commands the cursor follows the screen. If the character that the cursor is on is moved off the screen, the cursor is moved to the closest character that is on the screen. The value of 'sidescroll' is not used.

CommandDescription
z<Right>
zl
Move the view on the text [count] characters to the right, thus scroll the text [count] characters to the left. This only works when 'wrap' is off.
z<Left>
zh
Move the view on the text [count] characters to the left, thus scroll the text [count] characters to the right. This only works when 'wrap' is off.
zLMove the view on the text half a screen-width to the right, thus scroll the text half a screen-width to the left. This only works when 'wrap' is off.
zHMove the view on the text half a screen-width to the left, thus scroll the text half a screen-width to the right. This only works when 'wrap' is off.

Insert and Replace mode

1. Special keys

CommandDescription
CTRL-[
<Esc>
End insert or Replace mode, go back to Normal mode. Note: If your <Esc> key is hard to hit on your keyboard, train yourself to use CTRL-[.
CTRL-CQuit insert mode, go back to Normal mode.
CTRL-WDelete the word before the cursor.

2. Special special keys

CommandDescription
<Left>Cursor one character left.
<Right>Cursor one character right.

7. Insert mode completion

Completing whole lines

CommandDescription
CTRL-X CTRL-LSearch backwards for a line that starts with the same characters as those in the current line before the cursor. Indent is ignored. The matching line is inserted in front of the cursor.
CTRL-NSearch forward for next matching line. This line replaces the previous matching line.
CTRL-PSearch backwards for next matching line. This line replaces the previous matching line.
CTRL-LSame as CTRL-P.

Completing keywords in current file

CommandDescription
CTRL-X CTRL-N
CTRL-NSearch forward for next matching keyword. This keyword replaces the previous matching keyword.
CTRL-PSearch backwards for next matching keyword. This keyword replaces the previous matching keyword.

Completing file names

CommandDescription
CTRL-X CTRL-FSearch for the first file name that starts with the same characters as before the cursor. The matching file name is inserted in front of the cursor.
CTRL-NSearch forwards for next matching file name. This file name replaces the previous matching file name.
CTRL-PSearch backward for previous matching file name. This file name replaces the previous matching file name.
CTRL-FSame as CTRL-N.

Completing tags

CommandDescription
CTRL-X CTRL-]Search for the first tag that starts with the same characters as before the cursor. The matching tag is inserted in front of the cursor. See also CTRL-].
CTRL-NSearch forwards for next matching tag. This tag replaces the previous matching tag.
CTRL-PSearch backward for previous matching tag. This tag replaces the previous matching tag.
CTRL-]Same as CTRL-N.

Completing keywords from different sources

CommandDescription
CTRL-NFind next match for words that start with the keyword in front of the cursor.
CTRL-PFind previous match for words that start with the keyword in front of the cursor.
CTRL-NSearch forward for next matching keyword.
CTRL-PSearch backwards for next matching keyword.

8. Insert mode commands

The following commands can be used to insert new text into the buffer. They can all be undone and repeated with the "." command.

CommandDescription
aAppend text after the cursor [count] times. If the cursor is in the first column of an empty line Insert starts there. But not when 'virtualedit' is set!
AAppend text at the end of the line [count] times.
i
<insert>
Insert text before the cursor [count] times.
IInsert text before the first non-blank in the line [count] times.
gIInsert text in column 1 [count] times.
giInsert text in the same position as where Insert mode was stopped last time in the current buffer.
This uses the '^ mark. It's different from "`^i" when the mark is past the end of the line.
The position is corrected for inserted/deleted lines, but NOT for inserted/deleted characters. #949
oBegin a new line below the cursor and insert text, repeat [count] times.
OBegin a new line above the cursor and insert text, repeat [count] times.

Deleting and replacing text

1. Deleting text

CommandDescription
["x]<Del> or
["x]x
Delete [count] characters under and after the cursor [into register x] (not linewise). Does the same as "dl".
["x]XDelete [count] characters before the cursor [into register x] (not linewise). Does the same as "dh".
["x]d{motion}Delete text that {motion} moves over [into register x]. There are some exceptions.
["x]ddDelete [count] lines [into register x] linewise.
["x]DDelete the characters under the cursor until the end of the line and [count]-1 more lines [into register x]; synonym for "d$". (not linewise).
{Visual}["x]x or
{Visual}["x]d or
{Visual}["x]<Del>
Delete the highlighted text [into register x] (for {Visual} see Visual-mode).
{Visual}["x]X
{Visual}["x]D
Delete the highlighted lines [into register x] (for {Visual} see Visual-mode). In Visual block mode, "D" deletes the highlighted text plus all text until the end of the line.
:[range]d[elete] [x]Delete [range] lines (default: current line) [into register x].
CommandDescription
JJoin [count] lines, with a minimum of two lines. Remove the indent and insert up to two spaces (see below). Fails when on the last line of the buffer. If [count] is too big it is reduced to the number of lines available.
{Visual}JJoin the highlighted lines, with a minimum of two lines. Remove the indent and insert up to two spaces (see below).
gJJoin [count] lines, with a minimum of two lines. Don't insert or remove any spaces.
{Visual}gJJoin the highlighted lines, with a minimum of two lines. Don't insert or remove any spaces.

2. Delete and insert

CommandDescription
REnter Replace mode: Each character you type replaces an existing character, starting with the character under the cursor.
["x]c{motion}Delete {motion} text [into register x] and start insert.
["x]ccDelete [count] lines [into register x] and start insert linewise.
["x]CDelete from the cursor position to the end of the line and [count]-1 more lines [into register x], and start insert. Synonym for c$ (not linewise).
["x]sDelete [count] characters [into register x] and start insert (s stands for Substitute). Synonym for "cl" (not linewise).
["x]SDelete [count] lines [into register x] and start insert. Synonym for "cc" linewise.
{Visual}["x]c
{Visual}["x]s
Delete the highlighted text [into register x] and start insert (for {Visual} see Visual-mode).
{Visual}r{char}Replace all selected characters by {char}.
{Visual}["x]CDelete the highlighted lines [into register x] and start insert.
{Visual}["x]SDelete the highlighted lines [into register x] and start insert (for {Visual} see Visual-mode).
{Visual}["x]RCurrently just like {Visual}["x]S. In a next version it might work differently.

3. Simple changes

CommandDescription
r{char}Replace the character under the cursor with {char}.

The following commands change the case of letters.

CommandDescription
~'notildeop' option: Switch case of the character under the cursor and move the cursor to the right. If a [count] is given, do that many characters.
~{motion}'tildeop' option: switch case of {motion} text.
g~{motion}Switch case of {motion} text.
g~g~
g~~
Switch case of current line.
{Visual}~Switch case of highlighted text (for {Visual} see Visual-mode).
{Visual}UMake highlighted text uppercase (for {Visual} see Visual-mode).
gU{motion}Make {motion} text uppercase.
gUgU
gUU
Make current line uppercase.
{Visual}uMake highlighted text lowercase (for {Visual} see Visual-mode).
gu{motion}Make {motion} text lowercase.
gugu
guu
Make current line lowercase.

Adding and subtracting

CommandDescription
CTRL-AAdd [count] to the number or alphabetic character at or after the cursor.
{Visual}CTRL-AAdd [count] to the number or alphabetic character in the highlighted text.
{Visual}g CTRL-AAdd [count] to the number or alphabetic character in the highlighted text. If several lines are highlighted, each one will be incremented by an additional [count] (so effectively creating a [count] incrementing sequence).
CTRL-XSubtract [count] from the number or alphabetic character at or after the cursor.
{Visual}CTRL-XSubtract [count] from the number or alphabetic character in the highlighted text.
{Visual}g CTRL-XSubtract [count] from the number or alphabetic character in the highlighted text. If several lines are highlighted, each value will be decremented by an additional [count] (so effectively creating a [count] decrementing sequence).

SHIFTING LINES LEFT OR RIGHT

CommandDescription
<{motion}Shift {motion} lines leftwards.
<Shift [count] lines leftwards.
{Visual}[count]<Shift the highlighted lines [count] leftwards (for {Visual} see Visual-mode).
>{motion}Shift {motion} lines one rightwards.
>Shift [count] lines one rightwards.
{Visual}[count]>Shift the highlighted lines [count] rightwards (for {Visual} see Visual-mode).

4. Complex changes

CommandDescription
={motion}Filter {motion} lines through the re-indent command.
==Filter [count] lines like with ={motion}.
{Visual}=Filter the highlighted lines like with ={motion}.

4.2 Substitute

CommandDescription
:[range]s[ubstitute]/{pattern}/{string}/[flags] [count]For each line in [range] replace a match of {pattern} with {string}. When [range] and [count] are omitted, replace in the current line only. When [count] is given, replace in [count] lines, starting with the last line in [range]. When [range] is omitted start in the current line. [count] must be a positive number. See :s_flags for [flags].
:[range]s[ubstitute] [flags] [count]

:[range]&[&][flags] [count]
Repeat last :substitute with same search pattern and substitute string, but without the same flags. You may add [flags], see :s_flags.
&Synonym for :s (repeat last substitute). Note that the flags are not remembered, thus it might actually work differently. You can use :&& to keep the flags.
g&Synonym for :%s//~/& (repeat last substitute with last search pattern on all lines with the same flags). For example, when you first do a substitution with :s/pattern/repl/flags and then /search for something else, g& will do :%s/search/repl/flags. Mnemonic: global substitute.

The flags that you can use for the substitute commands:

FlagDescription
[c]Confirm each substitution.
[&]Must be the first one: Keep the flags from the previous substitute command. Examples: :&& :s/this/that/&. Note that :s and :& don't keep the flags.
[g]Replace all occurrences in the line. Without this argument, replacement occurs only for the first occurrence in each line.
[i]Ignore case for the pattern. The 'ignorecase' and 'smartcase' options are not used.
[I]Don't ignore case for the pattern. The 'ignorecase' and 'smartcase' options are not used.

5. Copying and moving text

CommandDescription
"{register}Use {register} for next delete, yank or put. Use an uppercase character to append with delete and yank. Registers ".", "%", "#" and ":" only work with put.
:reg[isters]Display the type and contents of all numbered and named registers.
["x]y{motion}Yank {motion} text [into register x].
["x]yyYank [count] lines [into register x] linewise.
["x]Yyank [count] lines [into register x] (synonym for yy, linewise). If you like "Y" to work from the cursor to the end of line (which is more logical, but not Vi-compatible) use ":map Y y$".
{Visual}["x]yYank the highlighted text [into register x] (for {Visual} see Visual-mode).
{Visual}["x]YYank the highlighted lines [into register x] (for {Visual} see Visual-mode).
:[range]y[ank] [x]Yank [range] lines [into register x].
["x]pPut the text [from register x] after the cursor [count] times.
["x]PPut the text [from register x] before the cursor [count] times.
["x]gpJust like "p", but leave the cursor just after the new text.
["x]gPJust like "P", but leave the cursor just after the new text.
["x]]pLike "p", but adjust the indent to the current line.
["x][P
["x]]P
["x][p
Like "P", but adjust the indent to the current line.

There are ten types of registers:

#Type
1.The unnamed register ""
2.10 numbered registers "0 to "9
3.The small delete register "-
4.26 named registers "a to "z or "A to "Z
5.Three read-only registers "%
5.Three read-only registers ":, ".
6.Alternate buffer register "#
7.The expression register "=
8.The selection and drop registers "*, "+
8.The selection and drop registers ~
9.The black hole register "_
10.Last search pattern register "/

The next two commands always work on whole lines.

CommandDescription
:[range]co[py] {address}Copy the lines given by [range] to below the line given by {address}.
:[range]m[ove] {address}Move the lines given by [range] to below the line given by {address}.

6. Formatting text

CommandDescription
gq{motion}Format the lines that {motion} moves over. Formatting is done internally. The 'textwidth' option controls the length of each formatted line (see below). If the 'textwidth' option is 0, the formatted line length is the screen width (with a maximum width of 79). NOTE: The "Q" command formerly performed this function. If you still want to use "Q" for formatting, use this mapping: :nnoremap Q gq.
gqgq
gqq
Format the current line. With a count format that many lines.
{Visual}gqFormat the highlighted text. (for {Visual} see Visual-mode).

7. Sorting text

CommandDescription
:[range]sor[t]! [i][u]Sort lines in [range]. When no range is given all lines are sorted.

With [!] the order is reversed.

With [i] case is ignored.

With [u] (u stands for unique) only keep the first of a sequence of identical lines (ignoring case when [i] is used). Without this flag, a sequence of identical lines will be kept in their original order. Note that leading and trailing white space may cause lines to be different.

Undo and Redo

CommandDescription
uUndo [count] changes
CTRL-RRedo [count] changes which were undone
UUndo all latest changes on one line, the line where the latest change was made

Repeating commands

1. Single repeats

CommandDescription
[count].Repeat last change, with count replaced with [count]. Does not repeat a command-line command.

Simple changes can be repeated with the "." command. Without a count, the count of the last change is used. If you enter a count, it will replace the last one.

CommandDescription
@:Repeat last command-line [count] times

2. Multiple repeats

CommandDescription
:[range]g[lobal]/{pattern}/[cmd]Execute the Ex command [cmd] (default ":p") on the lines within [range] where {pattern} matches. Currently only works with a few commands like print.
:[range]g[lobal]!/{pattern}/[cmd]Execute the Ex command [cmd] (default ":p") on the lines within [range] where {pattern} does NOT match. Currently only works with a few commands like print.
:[range]v[global]/{pattern}/[cmd]Same as :g!.

3. Complex repeats

CommandDescription
q{0-9a-zA-Z"}Record typed characters into register {0-9a-zA-Z"} (uppercase to append)
qStops recording
@{0-9a-z"}Execute the contents of register {0-9a-z"} [count] times
@{=*+}Execute the contents of register {=*+} [count] times
@@Repeat the previous @{0-9a-z":*} [count] times

Using the Visual mode (selecting a text area)

2. Starting and stopping Visual mode

CommandDescription
vStart Visual mode per character
[count]VStart Visual mode linewise
CTRL-VStart Visual mode blockwise
gvStart visual mode with the same area as the previous area and the same mode
gnSearch forward for the last used search pattern, like with n, and start Visual mode to select the match.
gNLike gn but searches backward, like with N
<Esc> or CTRL-CStop Visual mode.

3. Changing the Visual area

CommandDescription
oGo to Other end of highlighted text: The current cursor position becomes the start of the highlighted text and the cursor is moved to the other end of the highlighted text. The highlighted area remains the same.
OGo to Other end of highlighted text. This is like "o", but in Visual block mode the cursor moves to the other corner in the same line. The highlighted area remains the same.

Various remaining commands

CommandDescription
gaPrint the ascii value of the character under the cursor in dec, hex and oct.
:as[cii]Same as ga.
:sh[ell]This command starts a shell.
:!{cmd}Execute {cmd} with the shell.
:!!Repeat last ":!{cmd}".
:sil[ent] {command}Execute {command} silently.
:norm[al][!] {commands}Execute Normal mode commands {commands}. #128
:{range}norm[al][!] {commands}Execute Normal mode commands {commands} for each line in the {range}. #128

Command-line editing

1. Command-line editing

CommandDescription
<Left>Cursor left.
<Right>Cursor right.
<S-Left>
<C-Left>
Cursor one WORD left.
<S-Right>
<C-Right>
Cursor one WORD right.
CTRL-B
<Home>
Cursor to beginning of command-line.
CTRL-E
<End>
Cursor to end of command-line.
CTRL-H
<BS>
Delete the character in front of the cursor.
<Del>Delete the character under the cursor (at end of line: character before the cursor).
CTRL-WDelete the word before the cursor.
CTRL-URemove all characters between the cursor position and the beginning of the line.
CTRL-[
<Esc>
Quit Command-line mode without executing.
CTRL-CQuit Command-line mode without executing.
<Tab>Go to next matched completion.
<Up>Recall older command-line from history, whose beginning matches the current command-line.
<Down>Recall more recent command-line from history, whose beginning matches the current command-line.
:his[tory]Print the history of last entered commands.
:his[tory] [{name}]List the contents of history {name} which can be:
c[md] or : command-line history
s[earch] or / or ? search string history
e[xpr] or = expression register history
i[nput] or @ input line history
d[ebug] or > debug command history
a[ll] all of the above

2. Command-line completion

CommandDescription
<S-Tab>Like <Tab>, but begin with the last match and then go to the previous match.
CTRL-NGo to next match. Otherwise recall more recent command-line from history.
CTRL-PGo to previous match. Otherwise recall older command-line from history.

4. Ex command-line ranges

Some Ex commands accept a line range in front of them. This is noted as [range]. It consists of one or more line specifiers, separated with ',' or ';'.

Line numbers may be specified with:

CommandDescription
{number}An absolute line number.
.The current line.
$The last line in the file.
%Equal to 1,$ (the entire file).
'tPosition of mark t (lowercase).
'TPosition of mark T (uppercase); when the mark is in another file it cannot be used in a range.
/{pattern}[/]The next line where {pattern} matches (also see :range-pattern).
?{pattern}[?]The previous line where {pattern} matches (also see :range-pattern).
\/The next line where the previously used search pattern matches. #126
\?The previous line where the previously used search pattern matches. #126
\&The next line where the previously used substitute pattern matches. #126

Description of all options

1. Setting options

CommandDescription
:se[t] {option}?Show value of {option}.
:se[t] {option}Toggle option: set, switch it on. Number or String option: show value..
:se[t] no{option}Toggle option: Reset, switch it off.
:se[t] {option}!, :se[t] inv{option}Toggle option: Invert value.
:se[t] {option}={value}Set string or number option to {value}.

3. Options summary

In the list below all the options are mentioned with their full name and with an abbreviation if there is one. Both forms may be used.

Some options "proxy" to Sublime Text settings. This means that the option uses the underlying Sublime Text setting . Changing the option, changes the underlying Sublime Text setting. See this blog post about options.

OptionTypeDefaultDescription
'autoindent'
'ai'
Stringauto_indent
sublime setting
'belloff'
'bo'
String''; accepts 'all'
'equalalways'BooleanOn
'expandtab'
'et'
Booleantranslate_tabs_to_spaces
sublime setting
'hlsearch'
'hls'
BooleanOnWhen there is a previous search pattern, highlight all its matches. See also: 'incsearch'. When you get bored looking at the highlighted matches, you can turn it off with :nohlsearch. This does not change the option value, as soon as you use a search command, the highlighting comes back.
'ignorecase'
'ic'
BooleanOff
'incsearch'
'is'
BooleanOnWhile typing a search command, show where the pattern, as it was typed so far, matches. The matched string is highlighted. If the pattern is invalid or not found, nothing is shown. The screen will be updated often.
Note that the match will be shown, but the cursor will return to its original position when no match is found and when pressing <Esc>. You still need to finish the search command with <Enter> to move the cursor to the match.
When 'hlsearch' is on, all matched strings are highlighted too while typing a search command. See also: 'hlsearch'.
'list'Booleandraw_white_space
sublime setting
Useful to see the difference between tabs and spaces and for trailing blanks. ⭐
'magic'BooleanOn
'menu'BooleanOn
'minimap'BooleanOn
'modeline'
'ml'
BooleanOn
'modelines'
'mls'
Number5
'number'
'nu'
Booleanline_numbers
sublime setting
Print the line number in front of each line. ⭐
'relativenumber'
'rnu'
Booleanrelative_line_numbers
sublime setting
Show the line number relative to the line with the cursor in front of each line. Relative line numbers help you use the count you can precede some vertical motion commands (e.g., j k + -) with, without having to calculate it yourself. Especially useful in combination with other commands (e.g., y d c < > gq gw =). ⭐
'scrolloff'
'so'
Numberscroll_context_lines
sublime setting
'shell'String$SHELL or "sh", Win32: "cmd.exe"
'sidebar'BooleanOn
'smartcase'
'scs'
BooleanOff
'spell'Booleanspell_check
sublime setting
'statusbar'BooleanOn
'tabstop'
'ts'
Numbertab_size
sublime setting
'textwidth'
'tw'
Numberwrap_width
sublime setting
'winaltkeys'
'wak'
Stringmenu
'wrap'Booleanword_wrap
sublime setting
This option changes how text is displayed. It doesn't change the text in the buffer, see 'textwidth' for that.
When on, lines longer than the width of the window will wrap and displaying continues on the next line. When off lines will not wrap and only part of long lines will be displayed. When the cursor is moved to a part that is not shown, the screen will scroll horizontally.
'clipboard'String#829
'iskeyword'
'isk'
StringKeywords are used in searching and recognizing with many commands: "w", "*", "[i", etc. #622
'sidescrolloff'
'siso'
Number5The minimal number of screen columns to keep to the left and to the right of the cursor if 'nowrap' is set.
'splitbelow'
'sb'
BooleanOffWhen on, splitting a window will put the new window below the current one. :split
'splitright'
'spr'
BooleanOffWhen on, splitting a window will put the new window right of the current one. :vsplit

Regexp patterns and search commands

1. Search commands

CommandDescription
/{pattern}<CR>Search forward for the [count]'th occurrence of {pattern} exclusive.
/<CR>Search forward for the [count]'th occurrence of the latest used pattern.
?{pattern}<CR>Search backward for the [count]'th previous occurrence of {pattern} exclusive.
?<CR>Search backward for the [count]'th occurrence of the latest used pattern.
nRepeat the latest "/" or "?" [count] times. If the cursor doesn't move the search is repeated with count + 1.
NRepeat the latest "/" or "?" [count] times in opposite direction.
*Search forward for the [count]'th occurrence of the word nearest to the cursor. Only whole keywords are searched for, like with the command "/\<keyword\>". 'ignorecase' is used, 'smartcase' is not.
#Same as "*", but search backward. The pound sign (character 163) also works.
gdGo to local Declaration.
gDGo to global Declaration.
:noh[lsearch]Stop the highlighting for the 'hlsearch' option. It is automatically turned back on when using a search command, or setting the 'hlsearch' option.

While typing the search pattern the current match will be shown if the 'incsearch' option is on. Remember that you still have to finish the search command with <CR> to actually position the cursor at the displayed match. Or use <Esc> to abandon the search.

All matches for the last used search pattern will be highlighted if you set the 'hlsearch' option. This can be suspended with the :nohlsearch command.

3. Magic

Some characters in the pattern, such as letters, are taken literally. They match exactly the same character in the text. When preceded with a backslash however, these characters may get a special meaning. For example, "a" matches the letter "a", while "\a" matches any alphabetic character.

Other characters have a special meaning without a backslash. They need to be preceded with a backslash to match literally. For example "." matches any character while "." matches a dot.

If a character is taken literally or not depends on the 'magic' option and the items in the pattern mentioned next. The 'magic' option should always be set, but it can be switched off for Vi compatibility. We mention the effect of 'nomagic' here for completeness, but we recommend against using that.

Use of "\m" makes the pattern after it be interpreted as if 'magic' is set, ignoring the actual value of the 'magic' option.

Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used.

Use of "\v" means that after it, all ASCII characters except '0'-'9', 'a'-'z', 'A'-'Z' and '_' have special meaning: "very magic".

Use of "\V" means that after it, only a backslash and the terminating character (usually / or ?) have special meaning: "very nomagic".

Examples:

after:\v\m\M\Vmatches
'magic''nomagic'
aaaaliteral 'a'
\a\a\a\aany alphabetic character
..\.\.any character
\.\...literal dot
$$$\$end-of-line
**\*\*any number of the previous atom
~~\~\~latest substitute string
()\(\)\(\)\(\)group as an atom
|\|\|\|nothing: separates alternatives
\\\\\\\\literal backslash
\{{{{literal curly brace

If you want to you can make a pattern immune to the 'magic' option being set or not by putting "\m" or "\M" at the start of the pattern.

Key mapping and abbreviations

NOTE

At present, the "Select" mode corresponds to the Multiple Cursor mode. In a forthcoming update, Multiple Cursor mode will be distinguished with its dedicated designation.

Map the key sequence {lhs} to {rhs} for the modes where the map command applies. Disallow mapping of {rhs}, to avoid nested and recursive mappings. Often used to redefine a command.

CommandModes
:no[remap] {lhs} {rhs}Normal, Visual, and Operator-pending modes.
:nn[oremap] {lhs} {rhs}Normal mode.
:vn[oremap] {lhs} {rhs}Visual and Select mode.
:xn[oremap] {lhs} {rhs}Visual mode.
:snor[emap] {lhs} {rhs}Select mode.
:ono[remap] {lhs} {rhs}Operator-pending mode.
:ino[remap] {lhs} {rhs}Insert mode.

Remove the mapping of {lhs} for the modes where the map command applies. The mapping may remain defined for other modes where it applies. It also works when {lhs} matches the {rhs} of a mapping. This is for when an abbreviation applied.

NOTE

Trailing spaces are included in the {lhs}.

CommandModes
:unm[ap] {lhs}All modes.
:nun[map] {lhs}Normal mode.
:vu[nmap] {lhs}Visual and Select mode.
:xu[nmap] {lhs}Visual mode.
:sunm[ap] {lhs}Select mode.
:ou[nmap] {lhs}Operator-pending mode.
:iu[nmap] {lhs}Insert mode.

Map the key sequence {lhs} to {rhs} for the modes where the map command applies. The result, including {rhs}, is then further scanned for mappings. This allows for nested and recursive use of mappings. Note: Trailing spaces are included in the {rhs}, because space is a valid Normal mode command.

CommandModes
:map {lhs} {rhs}Normal, Visual, and Operator-pending mode.
:nm[ap] {lhs} {rhs}Normal mode.
:vm[ap] {lhs} {rhs}Visual and Select mode.
:xm[ap] {lhs} {rhs}Visual mode.
:smap {lhs} {rhs}Select mode.
:om[ap] {lhs} {rhs}Operator-pending mode.
:im[ap] {lhs} {rhs}Insert mode.

Tags and special searches

CommandDescription
CTRL-]Jump to the definition of the keyword under the cursor.

Commands for using multiple windows

NOTE

Some window commands, such as CTRL-w s, CTRL-w v, CTRL-w ], require Origami.

3. Opening and closing a window

CommandDescription
CTRL-W s
CTRL-W S
CTRL-W CTRL-S
:sp[lit] [file]
Split current window in two. The result is two viewports on the same file. The windows will be spread out if 'equalalways' is set. If [file] is given it will be edited in the new window.
CTRL-W CTRL-V
CTRL-W v
:vs[plit] [file]
Like :split, but split vertically. The windows will be spread out if 'equalalways' is set.
CTRL-W n
CTRL-W CTRL-N
:new
Create a new window and start editing an empty file in it. The windows will be spread out if 'equalalways' is set. This behaves like a ":split" first, and then an ":enew" command.
:vne[w] [file]Like :new, but split vertically. If 'equalalways' is set the windows will be spread out horizontally, unless a width was specified.
:new {file}
:sp[lit] {file}
Create a new window and start editing file {file} in it. This behaves almost like a ":split" first, and then an ":edit" command, but the alternate file name in the original window is set to {file}. The windows will be spread out if 'equalalways' is set.
:sv[iew] [file]Same as ":split", but set 'readonly' option for this buffer.
:sf[ind] {file}Same as ":split", but search for {file} in 'path' like in :find. Doesn't split if {file} is not found.
CTRL-W CTRL-^
CTRL-W ^
Split the current window in two and edit the alternate file.
CTRL-W :Does the same as typing : - enter a command line

Closing a window

CommandDescription
:q[uit]
CTRL-W q
CTRL-W CTRL-Q
Quit the current window.
:q[uit]!If this was the last window for a buffer, any changes to that buffer are lost. When quitting the last window (not counting help windows), exit Vim,
:clo[se][!]
CTRL-W c
Close the current window.
CTRL-W CTRL-CYou might have expected that CTRL-W CTRL-C closes the current window, but that does not work, because the CTRL-C cancels the command.
:hid[e]Quit the current window, unless it is the last window on the screen.
:hid[e] {cmd}Execute {cmd} with 'hidden' is set.
:on[ly][!]
CTRL-W o
CTRL-W CTRL-O
Make the current window the only one on the screen.

4. Moving cursor to other windows

CommandDescription
CTRL-W <Down>
CTRL-W CTRL-J
CTRL-W j
Move cursor to Nth window below current one.
CTRL-W <Up>
CTRL-W CTRL-K
CTRL-W k
Move cursor to Nth window above current one.
CTRL-W <Left>
CTRL-W CTRL-H
CTRL-W <BS>
CTRL-W h
Move cursor to Nth window left of current one.
CTRL-W <Right>
CTRL-W CTRL-L
CTRL-W l
Move cursor to Nth window right of current one.
CTRL-W w
CTRL-W CTRL-W
Move cursor to window below/right of the current one.
CTRL-W WMove cursor to window above/left of current one.
CTRL-W t
CTRL-W CTRL-T
Move cursor to top-left window.
CTRL-W b
CTRL-W CTRL-B
Move cursor to bottom-right window.
CTRL-W p
CTRL-W CTRL-P
Go to previous (last accessed) window.
CTRL-W PGo to preview window.

5. Moving windows around

CommandDescription
CTRL-W r
CTRL-W CTRL-R
Rotate windows downwards/rightwards. The first window becomes the second one, the second one becomes the third one, etc. The last window becomes the first window. The cursor remains in the same window. This only works within the row or column of windows that the current window is in.
CTRL-W RRotate windows upwards/leftwards. The second window becomes the first one, the third one becomes the second one, etc. The first window becomes the last window. The cursor remains in the same window. This only works within the row or column of windows that the current window is in.
CTRL-W x
CTRL-W CTRL-X
Exchange current window with next one. If there is no next window, exchange with previous window.

The following commands can be used to change the window layout. For example, when there are two vertically split windows, CTRL-W K will change that in horizontally split windows. CTRL-W H does it the other way around.

CommandDescription
CTRL-W KMove the current window to be at the very top, using the full width of the screen. This works like closing the current window and then creating another one with :topleft split, except that the current window contents is used for the new window.
CTRL-W JMove the current window to be at the very bottom, using the full width of the screen. This works like closing the current window and then creating another one with :botright split, except that the current window contents is used for the new window.
CTRL-W HMove the current window to be at the far left, using the full height of the screen. This works like closing the current window and then creating another one with :vert topleft split, except that the current window contents is used for the new window.
CTRL-W LMove the current window to be at the far right, using the full height of the screen. This works like closing the current window and then creating another one with :vert botright split, except that the current window contents is used for the new window.
CTRL-W TMove the current window to a new tab page. This fails if there is only one window in the current tab page. When a count is specified the new tab page will be opened before the tab page with this index. Otherwise it comes after the current tab page.

6. Window resizing

CommandDescription
CTRL-W =Make all windows (almost) equally high and wide.
CTRL-W CTRL-_
CTRL-W _
Set current window height to N (default: highest possible).
CTRL-W |Set current window width to N (default: widest possible).

When the option 'equalalways' ('ea') is set, all the windows are automatically made the same size after splitting or closing a window.

9. Tag or file name under the cursor

CommandDescription
CTRL-W ]
CTRL-W CTRL-]
Split current window in two. Use identifier under cursor as a tag and jump to it in the new upper window. In Visual mode uses the Visually selected text as a tag. Same as CTRL-], except in a split window.
CTRL-W gtGo to next tab page, same as gt.
CTRL-W gTGo to previous tab page, same as gT.

11. Using hidden buffers

CommandDescription
:files
:buffers
:ls
Show all buffers.
:b[uffer] [N]Edit buffer [N] from the buffer list. If [N] is not given, the current buffer remains being edited.
:b[uffer] #Edit alternate file buffer # from the buffer list. If # is not given, the current buffer remains being edited.
b[uffer] {bufname}Edit buffer for {bufname} from the buffer list. A partial name also works, so long as it is unique in the list of buffers.
:bn[ext] [N]Go to [N]th next buffer in buffer list. [N] defaults to one. Wraps around the end of the buffer list.
:bN[ext] [N]
:bp[revious] [N]
Go to [N]th previous buffer in buffer list. [N] defaults to one. Wraps around the start of the buffer list.
:br[ewind]Go to first buffer in buffer list. If the buffer list is empty, go to the first unlisted buffer.
:bf[irst]Same :brewind
:bl[ast]Go to last buffer in buffer list. If the buffer list is empty, go to the last unlisted buffer.

Commands for using multiple tab pages

2. Commands

OPENING A NEW TAB PAGE:

CommandDescription
:tabe[dit]
:tabnew
Open a new tab page with an empty window, after the current tab page.
CTRL-W gfOpen a new tab page and edit the file name under the cursor. See CTRL-W_gf.
CTRL-W gFOpen a new tab page and edit the file name under the cursor and jump to the line number following the file name. See CTRL-W_gF.

CLOSING A TAB PAGE:

CommandDescription
:tabc[lose]Close current tab page.
:tabo[nly]Close all other tab pages.

SWITCHING TO ANOTHER TAB PAGE:

CommandDescription
:tabn[ext]
<C-PageDown>
gt
Go to the next tab page. Wraps around from the last to the first one.
:tabp[revious]
:tabN[ext]
<C-PageUp>
gT
Go to the previous tab page. Wraps around from the first one to the last one.
:tabn[ext] {count}Go to tab page {count}. The first tab page has number one. Wraps around from the first one to the last one.
:tabp[revious] {count}Go {count} tab pages back. Wraps around from the first one to the last one.
:tabr[ewind]
:tabfir[st]
Go to the first tab page.
:tabl[ast]Go to the last tab page.

Spell checking

To search for the next misspelled word:

CommandDescription
]sMove to next misspelled word after the cursor. A count before the command can be used to repeat. 'wrapscan' applies.
[sLike "]s" but search backwards, find the misspelled word before the cursor. Doesn't recognize words split over two lines, thus may stop at words that are not highlighted as bad. Does not stop at word with missing capital at the start of a line.

To add words to your own word list:

CommandDescription
zgAdd word under the cursor as a good word to the first. In Visual mode the selected characters are added as a word (including white space!).
zuw
zug
Undo zg.
:spe[llgood] {word}Add {word} as a good word, like with zg.
:spellu[ndo] {word}Like zuw.

Finding suggestions for bad words:

CommandDescription
z=For the word under/after the cursor suggest correctly spelled words.

Working with versions of the same file

3. Jumping to diffs

Two commands can be used to jump to diffs:

CommandDescription
[cJump backwards to the previous start of a change. When a count is used, do it that many times.
]cJump forwards to the next start of a change. When a count is used, do it that many times.

It is an error if there is no change for the cursor to move to.

Expression evaluation, conditional commands

7. Commands

CommandDescription
:let {var-name}={expr1}Set internal variable {var-name} to the result of the expression {expr1}. The variable will get the type from the {expr}. If {var-name} didn't exist yet, it is created.
Only "mapleader" and "maplocalleader" are currently supported.
Example: let mapleader=,
Example: let maplocalleader=,

Hide (fold) ranges of lines

2. Fold commands

All folding commands start with "z". Hint: the "z" looks like a folded piece of paper, if you look at it from the side.

OPENING AND CLOSING FOLDS

CommandDescription
zoOpen one fold under the cursor.
zOSame as zo.
zcClose one fold under the cursor.
zCSame as zc.
zMClose all folds.
zROpen all folds.

Commands for a quick edit-compile-fix cycle

CommandDescription
:lne[xt]
:lN[ext]
:lp[revious]
:lfir[st]Same as ":lrewind".
:lla[st]
:cq[uit]Quit Sublime.

Win32 GUI

CommandDescription
:simaltSimulate pressing {key} while holding Alt pressed. #1004

Plugins

The following Vim plugins have been ported or have inspired implementations.

PluginReference
Abolishvim-abolish
Commentaryvim-commentary
Highlighted Yankvim-highlightedyank
Input Method Since 1.32vim-xkbswitch, VSCodeVim
Indent Objectvim-indent-object
Markology Since 1.32vim-markology
Multiple Cursorsvim-multiple-cursors, vim-visual-multi
Sneak Disabled by Default #731vim-sneak
Surroundvim-surround
Targetsvim-targets
Unimpairedvim-unimpaired

Suggested future ports

The following Vim plugins have been suggested for future implementations.

PluginReferenceIssue
EasyMotionvim-easymotion#276
Hophop.nvim#808
SurroundAny#743
WhichKeyvim-which-key#758
YankStackAndRing#337

Abolish

A port of the awesome vim-abolish.

StatusCommandDescription
cr{algorithm}Case mutating algorithms.
:AbolishSearch and substitute.
:SubvertMore concise syntax for search and substitute.

Commentary

A port of the awesome vim-commentary.

StatusCommandDescription
gc{motion}Comment or uncomment lines that {motion} moves over.
gcComment or uncomment [count] lines.
{Visual}gcComment or uncomment the highlighted lines.
gcText object for a comment (operator pending mode only).
gcgc
gcu
Uncomment the current and adjacent commented lines.

Highlighted Yank

Inspired by vim-highlightedyank.

Indent Object

A port of the awesome vim-indent-object.

StatusCommandDescription
[count]ai(A)n (I)ndentation level and line above.
ii(I)nner (I)ndentation level (no line above).
[count]ii(I)nner (I)ndentation level (no line above).
[count]aI(A)n (I)ndentation level and lines above/below.
[count]iI(I)nner (I)ndentation level (no lines above/below).

Input Method

Inspired by vim-xkbswitch, VSCodeVim, and others.

Markology

Inspired by vim-markology.

Multiple Cursors

Inspired by vim-multiple-cursors.

StatusCommandDescription
<C-n>, ghStart multiple cursor.
<C-n>, n, jAdd next match.
<C-x>, n, q, lSkip next match.
<C-p>, N, Q, kRemove current match.
<M-n>, \\ASelect all matches.
<Esc>, J, <Tab>Quit or enter normal mode (default).
v, <Tab>Enter normal mode.
gHSelect all search occurrences (/, ?, *, #).

A (select all matches) is deprecated, use \\A instead.

Sneak

A port of the awesome vim-sneak.

Normal mode

StatusCommandDescription
s{char}{char}Go to the next occurrence of {char}{char}
S{char}{char}Go to the previous occurrence of {char}{char}
s{char}<Enter>Go to the next occurrence of {char}
S{char}<Enter>Go to the previous occurrence of {char}
s<Enter>Repeat the last Sneak.
S<Enter>Repeat the last Sneak, in reverse direction.
;Go to the [count]th next match
, or \Go to the [count]th previous match
sGo to the [count]th next match
SGo to the [count]th previous match
[count]s{char}{char}Invoke sneak-vertical-scope
[count]S{char}{char}Invoke backwards sneak-vertical-scope
{operator}z{char}{char}Perform {operator} from the cursor to the next occurrence of {char}{char}
{operator}Z{char}{char}Perform {operator} from the cursor to the previous occurrence of {char}{char}

Visual mode

StatusCommandDescription
s{char}{char}Go to the next occurrence of {char}{char}
Z{char}{char}Go to the previous occurrence of {char}{char}
s{char}<Enter>Go to the next occurrence of {char}
Z{char}<Enter>Go to the previous occurrence of {char}
s<Enter>Repeat the last Sneak.
Z<Enter>Repeat the last Sneak, in reverse direction.
;Go to the [count]th next match
, or \Go to the [count]th previous match
sGo to the [count]th next match
SGo to the [count]th previous match

Label mode

StatusCommandDescription
<Space> or <Esc>Exit sneak-label-mode where the cursor is.
<Tab>Label the next set of matches.
<BS> or <S-Tab>Label the previous set of matches.

Surround

A port of the awesome vim-surround.

StatusCommandDescription
csChange surroundings.
dsDelete surroundings.
ysYank and change surroundings.
yssOperates on current line, ignoring whitespace.
{Visual}SWith an argument wraps the selection.
cSChange surroundings and put on own line.
ySYank and change surroundings and put on own line.

Targets

Inspired by targets.vim.

StatusCommandDescription
i( i) ib i{ i} iB i[ i] i< i> itIn Pair.
a( a) ab a{ a} aB a[ a] a< a> atA Pair.
i, i. i; i: i+ i- i= i~ i_ i* i# i/ i| i\ i& i$In Separator.
a, a. a; a: a+ a- a= a~ a_ a* a# a/ a| a\ a& a$A Separator.
I( I) I{ I} IB I[ I] I< I> ItInside Pair.
A( A) A{ A} AB A[ A] A< A> AtAround Pair.
in( an( In( An( il( al( Il( Al(Next and Last Pair.
I, I. I; I: I+ I- I= I~ I_ I* I# I/ I| I\ I& I$Inside Separator.
A, A. A; A: A+ A- A= A~ A_ A* A# A/ A| A\ A& A$Around Separator.
in, an, In, An, il, al, Il, Al, ...Next and Last Separator.
iaIn Argument.
aaAn Argument.
IaInside Argument.
AaAround Argument.
ina ana Ina Ana ila ala Ila AlaNext and Last Argument.
inb anb Inb Anb ilb alb Ilb AlbAny Block.
inq anq Inq Anq ilq alq Ilq AlqAny Quote.
Quote Text Objects.
In Quote.
A Quote.
Inside Quote.
Around Quote.
Next and Last Quote.

Unimpaired

A port of the awesome vim-unimpaired.

Next and previous

StatusCommandDescription
[a:previous
]a:next
[A:first
]A:last
[b:bprevious
]b:bnext
[B:bfirst
]B:blast
[l:lprevious - Jump to previous lint-error (requires SublimeLinter).
]l:lnext - Jump to next lint-error (requires SublimeLinter).
[L:lfirst
]L:llast
[<C-L>:lpfile
]<C-L>:lnfile
[q:cprevious
]q:cnext
[Q:cfirst
]Q:clast
[<C-Q>:cpfile (Note that <C-Q> only works in a terminal if you disable
]<C-Q>:cnfile flow control: stty -ixon)
[t:tprevious
]t:tnext
[T:tfirst
]T:tlast
[<C-T>:ptprevious
]<C-T>:ptnext
[fGo to the file preceding the current one alphabetically in the current file's directory. In the quickfix window, equivalent to :colder.
]fGo to the file succeeding the current one alphabetically in the current file's directory. In the quickfix window, equivalent to :cnewer.
[nGo to the previous SCM conflict marker or diff/patch hunk. Try d[n inside a conflict.
]nGo to the next SCM conflict marker or diff/patch hunk.

Line operations

StatusCommandDescription
[<Space>Add [count] blank lines above the cursor.
]<Space>Add [count] blank lines below the cursor.
[eExchange the current line with [count] lines above it.
]eExchange the current line with [count] lines below it.
>pPaste after linewise, increasing indent.
>PPaste before linewise, increasing indent.
<pPaste after linewise, decreasing indent.
<PPaste before linewise, decreasing indent.
=pPaste after linewise, re-indenting.
=PPaste before linewise, re-indenting.

Option toggling

StatusOnOffToggleOption
[ob]obyob'background' (dark is off, light is on)
[oc]ocyoc'cursorline'
[od]odyod'diff' (actually :diffthis / :diffoff)
[oh]ohyoh'hlsearch'
[oi]oiyoi'ignorecase'
[ol]olyol'list'
[on]onyon'number'
[or]oryor'relativenumber'
[os]osyos'spell'
[ot]otyot'colorcolumn' ("+1" or last used value)
[ou]ouyou'cursorcolumn'
[ov]ovyov'virtualedit'
[ow]owyow'wrap'
[ox]oxyox'cursorline' 'cursorcolumn' (x as in crosshairs)

Option toggling (specific to Sublime Text)

StatusOnOffToggleOption
✅ ⭐[oa]oayoa'menu'
✅ ⭐[oe]oeyoe'statusbar'
✅ ⭐[om]omyom'minimap'
✅ ⭐[ot]otyot'sidebar'