Vim (Advanced) Keyboard Shortcuts

Complete Vim (Advanced) keyboard shortcuts reference — 296 shortcuts across 27 categories. Quick reference cheat sheet for Cross-platform.

Left-right motions (17)

ShortcutAction
hleft (also: CTRL-H, <BS>, or <Left> key)
lright (also: <Space> or <Right> key)
0to first character in the line (also: <Home> key)
^to first non-blank character in the line
$to the last character in the line (N-1 lines lower) (also: <End> key)
g0to first character in screen line (differs from "0" when lines wrap)
g^to first non-blank character in screen line (differs from "^" when lines wrap)
g$to last character in screen line (differs from "$" when lines wrap)
gmto middle of the screen line
gMto middle of the line
barto column N (default: 1)
fto the Nth occurrence of {char} to the right
Fto the Nth occurrence of {char} to the left
ttill before the Nth occurrence of {char} to the right
Ttill before the Nth occurrence of {char} to the left
;repeat the last "f", "F", "t", or "T" N times
,repeat the last "f", "F", "t", or "T" N times in opposite direction

Up-down motions (10)

ShortcutAction
kup N lines (also: CTRL-P and <Up>)
jdown N lines (also: CTRL-J, CTRL-N, <NL>, and <Down>)
-up N lines, on the first non-blank character
+down N lines, on the first non-blank character (also: CTRL-M and <CR>)
_down N-1 lines, on the first non-blank character
Ggoto line N (default: last line), on the first non-blank character
gggoto line N (default: first line), on the first non-blank character
N%goto line N percentage down in the file; N must be given, otherwise it is the % command
gkup N screen lines (differs from "k" when line wraps)
gjdown N screen lines (differs from "j" when line wraps)

Text object motions (28)

ShortcutAction
wN words forward
WN blank-separated WORDs forward
eforward to the end of the Nth word
Eforward to the end of the Nth blank-separated WORD
bN words backward
BN blank-separated WORDs backward
gebackward to the end of the Nth word
gEbackward to the end of the Nth blank-separated WORD
)N sentences forward
(N sentences backward
}N paragraphs forward
{N paragraphs backward
]]N sections forward, at start of section
[[N sections backward, at start of section
][N sections forward, at end of section
[]N sections backward, at end of section
[(N times back to unclosed '
[{N times back to unclosed '{'
[mN times back to start of method (for Java)
[MN times back to end of method (for Java)
])N times forward to unclosed ')'
]}N times forward to unclosed '}'
]mN times forward to start of method (for Java)
]MN times forward to end of method (for Java)
[#N times back to unclosed "#if" or "#else"
]#N times forward to unclosed "#else" or "#endif"
[starN times back to start of comment "/*"
]starN times forward to end of comment "*/"

Pattern searches (10)

ShortcutAction
/<CR>repeat last search, in the forward direction
?<CR>repeat last search, in the backward direction
nrepeat last search
Nrepeat last search, in opposite direction
starsearch forward for the identifier under the cursor
#search backward for the identifier under the cursor
gstarlike "*", but also find partial matches
g#like "#", but also find partial matches
gdgoto local declaration of identifier under the cursor
gDgoto global declaration of identifier under the cursor

Various motions (6)

ShortcutAction
%find the next brace, bracket, comment, or "#if"/ "#else"/"#endif" in this line and go to its
Hgo to the Nth line in the window, on the first non-blank
Mgo to the middle line in the window, on the first non-blank
Lgo to the Nth line from the bottom, on the first non-blank
gogo to Nth byte in the buffer
:gogo to [off] byte in the buffer

Scrolling (13)

ShortcutAction
CTRL-Ewindow N lines downwards (default: 1)
CTRL-Dwindow N lines Downwards (default: 1/2 window)
CTRL-Fwindow N pages Forwards (downwards)
CTRL-Ywindow N lines upwards (default: 1)
CTRL-Uwindow N lines Upwards (default: 1/2 window)
CTRL-Bwindow N pages Backwards (upwards)
z<CR>redraw, current line at top of window
z.redraw, current line at center of window
z-redraw, current line at bottom of window
zhscroll screen N characters to the right
zlscroll screen N characters to the left
zHscroll screen half a screenwidth to the right
zLscroll screen half a screenwidth to the left

Inserting text (9)

ShortcutAction
aappend text after the cursor (N times)
Aappend text at the end of the line (N times)
iinsert text before the cursor (N times) (also: <Insert>)
Iinsert text before the first non-blank in the line (N times)
gIinsert text in column 1 (N times)
oopen a new line below the current line, append text (N times)
Oopen a new line above the current line, append text (N times)
v_b_Iinsert the same text in front of all the selected lines
v_b_Aappend the same text after all the selected lines

Deleting text (12)

ShortcutAction
xdelete N characters under and after the cursor
<Del>delete N characters under and after the cursor
Xdelete N characters before the cursor
ddelete the text that is moved over with {motion}
v_ddelete the highlighted text
dddelete N lines
Ddelete to the end of the line (and N-1 more lines)
Jjoin N-1 lines (delete <EOL>s)
v_Jjoin the highlighted lines
gJlike "J", but without inserting spaces
v_gJlike "{visual}J", but without inserting spaces
:ddelete [range] lines [into register x]

Copying and moving text (12)

ShortcutAction
quoteuse register {char} for the next delete, yank, or put
:regshow the contents of all registers
yyank the text moved over with {motion} into a register
v_yyank the highlighted text into a register
yyyank N lines into a register
Yyank N lines into a register
pput a register after the cursor position (N times)
Pput a register before the cursor position (N times)
]plike p, but adjust indent to current line
[plike P, but adjust indent to current line
gplike p, but leave cursor after the new text
gPlike P, but leave cursor after the new text

Changing text (21)

ShortcutAction
rreplace N characters with {char}
grreplace N characters without affecting layout
Renter Replace mode (repeat the entered text N times)
gRenter virtual Replace mode: Like Replace mode but without affecting layout
cchange the text that is moved over with {motion}
v_cchange the highlighted text
ccchange N lines
Schange N lines
Cchange to the end of the line (and N-1 more lines)
schange N characters
v_b_cin Visual block mode: Change each of the selected lines with the entered text
v_b_Cin Visual block mode: Change each of the selected lines until end-of-line with the entered text
~switch case for N characters and advance cursor
v_~switch case for highlighted text
v_umake highlighted text lowercase
v_Umake highlighted text uppercase
<move the lines that are moved over with {motion} one shiftwidth left
<<move N lines one shiftwidth left
>move the lines that are moved over with {motion} one shiftwidth right
>>move N lines one shiftwidth right
gqformat the lines that are moved over with {motion} to 'textwidth' length

Complex changes (2)

ShortcutAction
==filter N lines through 'equalprg'
&Repeat previous ":s" on current line without options

Text objects (only in Visual mode or after an (20)

ShortcutAction
v_awSelect "a word"
v_iwSelect "inner word"
v_aWSelect "a WORD"
v_iWSelect "inner WORD"
v_asSelect "a sentence"
v_isSelect "inner sentence"
v_apSelect "a paragraph"
v_ipSelect "inner paragraph"
v_abSelect "a block" (from "[(" to "])")
v_ibSelect "inner block" (from "[(" to "])")
v_aBSelect "a Block" (from "[{" to "]}")
v_iBSelect "inner Block" (from "[{" to "]}")
v_a>Select "a <> block"
v_i>Select "inner <> block"
v_atSelect "a tag block" (from <aaa> to </aaa>)
v_itSelect "inner tag block" (from <aaa> to </aaa>)
v_a'Select "a single quoted string"
v_i'Select "inner single quoted string"
v_a`Select "a backward quoted string"
v_i`Select "inner backward quoted string"

Repeating commands (6)

ShortcutAction
.repeat last change (with count replaced with N)
qrecord typed characters into register {a-z}
@execute the contents of register {a-z} (N times)
:@execute the contents of register {a-z} as an Ex command
:@@repeat previous :@{a-z}
gsgoto Sleep for N seconds

External commands (3)

ShortcutAction
:shellstart a shell
:!execute {command} with a shell
Klookup keyword under the cursor with 'keywordprg' program (default: "man")

Quickfix commands (15)

ShortcutAction
:ccdisplay error [nr] (default is the same again)
:cnextdisplay the next error
:cpreviousdisplay the previous error
:clistlist all errors
:cfileread errors from the file 'errorfile'
:cgetbufferlike :cbuffer but don't jump to the first error
:cgetfilelike :cfile but don't jump to the first error
:cgetexprlike :cexpr but don't jump to the first error
:caddfileadd errors from the error file to the current quickfix list
:caddexpradd errors from an expression to the current quickfix list
:cbufferread errors from text in a buffer
:cexprread errors from an expression
:cquitquit without writing and return error code (to the compiler)
:makestart make, read errors, and jump to first error
:grepexecute 'grepprg' to find matches and jump to the first one

Various commands (13)

ShortcutAction
CTRL-Lclear and redraw the screen
CTRL-Gshow current file name (with path) and cursor position
gashow ascii value of character under cursor in decimal, hex, and octal
g8for utf-8 encoding: show byte sequence for character under cursor in hex
g_CTRL-Gshow cursor column, line, and character position
CTRL-Cduring searches: Interrupt the search
:versionshow version information
:modeset screen mode to N (obsolete)
Qswitch to "Ex" mode
:redirredirect messages to {file}
:silentexecute {command} silently
:confirmquit, write, etc., asking about unsaved changes or read-only files
:browseopen/read/write file, using a file selection dialog

Command-line editing (5)

ShortcutAction
c_CTRL-Dlist all names that match the pattern in front of the cursor
c_CTRL-Ainsert all names that match pattern in front of cursor
c_CTRL-Linsert longest common part of names that match pattern
c_CTRL-Nafter 'wildchar' with multiple matches: go to next match
c_CTRL-Pafter 'wildchar' with multiple matches: go to previous match

Starting Vim (5)

ShortcutAction
-vimstart editing with an empty buffer
-filestart editing one or more files
--read file from stdin
-tagedit the file associated with {tag}
-qfstart editing in QuickFix mode, display the first error

Using the argument list argument-list (4)

ShortcutAction
:argsprint the argument list, with the current file in "[]"
:allopen a window for every file in the arg list
:wnwrite file and edit next file
:wNwrite file and edit previous file

Writing and quitting (14)

ShortcutAction
:wwrite to the current file
:w_fwrite to {file}, unless it already exists
:w_aappend to the current file
:w_cexecute {cmd} with [range] lines as standard input
:upwrite to current file if modified
:wallwrite all changed buffers
:qquit current buffer, unless changes have been made; Exit Vim when there are no other non-help
:qaexit Vim, unless changes have been made
:cqquit without writing and return error code
:wqwrite the current file and exit
:xitlike ":wq" but write only when changes have been made
ZZsame as ":x"
ZQsame as ":q!"
:stopsuspend Vim or start new shell; if 'aw' option is set and [!] not given write the buffer

Automatic Commands (3)

ShortcutAction
:rviminforead info from viminfo file [file]
:wviminfoadd info to viminfo file [file]
modelineIn the first and last lines of the file (see 'ml' option), {set-arg} is given as an argument

Multi-window commands (30)

ShortcutAction
CTRL-W_ssplit window into two parts
:split_fsplit window and edit {file} in one of them
:vsplitsame, but split vertically
:verticalmake {cmd} split vertically
:sfindsplit window, find {file} in 'path' and edit it
:terminalopen a terminal window
CTRL-W_]split window and jump to tag under cursor
CTRL-W_fsplit window and edit file name under the cursor
CTRL-W_^split window and edit alternate file
CTRL-W_ncreate new empty window
CTRL-W_qquit editing and close window
CTRL-W_cmake buffer hidden and close window
CTRL-W_omake current window only one on the screen
CTRL-W_jmove cursor to window below
CTRL-W_kmove cursor to window above
CTRL-W_CTRL-Wmove cursor to window below (wrap)
CTRL-W_Wmove cursor to window above (wrap)
CTRL-W_tmove cursor to top window
CTRL-W_bmove cursor to bottom window
CTRL-W_pmove cursor to previous active window
CTRL-W_rrotate windows downwards
CTRL-W_Rrotate windows upwards
CTRL-W_xexchange current window with next one
CTRL-W_=make all windows equal height & width
CTRL-W_-decrease current window height
CTRL-W_+increase current window height
CTRL-W__set current window height (default: very high)
CTRL-W_<decrease current window width
CTRL-W_>increase current window width
CTRL-W_barset current window width (default: widest possible)

Buffer list commands (6)

ShortcutAction
:bufferslist all known buffer and file names
:balledit all args/buffers
:unhideedit all loaded buffers
:baddadd file name {fname} to the list
:bunloadunload buffer [N] from memory
:bdeleteunload buffer [N] and delete it from the buffer list

Syntax Highlighting (6)

ShortcutAction
:syn-onstart using syntax highlighting
:syn-offstop using syntax highlighting
:syntaxlist current syntax items
:syn-clearclear all syntax info
:highlightclear all highlight info
:filetypeswitch on file type detection, without syntax highlighting

GUI commands (4)

ShortcutAction
:guiUNIX: start the GUI
:menulist all menus
:tmenuadd tooltip to menu {mpath}
:unmenuremove menu {mpath}

Folding (15)

ShortcutAction
zfoperator: Define a fold manually
:folddefine a fold for {range} lines
zddelete one fold under the cursor
zDdelete all folds under the cursor
zoopen one fold under the cursor
zOopen all folds under the cursor
zcclose one fold under the cursor
zCclose all folds under the cursor
zmfold more: decrease 'foldlevel'
zMclose all folds: make 'foldlevel' zero
zrreduce folding: increase 'foldlevel'
zRopen all folds: make 'foldlevel' max
znfold none: reset 'foldenable'
zNfold normal set 'foldenable'
ziinvert 'foldenable'

Additional Shortcuts (7)

ShortcutAction
ci"Change inside quotes
di{Delete inside braces
gg=GIndent all
Ctrl + VBlock visual
:%s/foo/bar/gcConfirm replace
q[register]Record macro
@[register]Play macro
📄 View Printable Cheat Sheet — Download as PDF or print · 🧩 Combine with other tools

Related Shortcut Pages

Vim Neovim / Vim Helix Editor Emacs Nano tmux

Search 13,500+ shortcuts across 269 platforms

Explore All Platforms Practice Shortcuts

🤖 Ask AI about Vim (Advanced) shortcuts

Open your assistant with this page preloaded as the source — great for follow-up questions like "which of these work in other apps?"

ChatGPT Claude Perplexity Gemini Grok
📜 Every shortcut on this page is taken from the official Vim (Advanced) documentation — vimhelp.org
🔧 Spotted an error or a missing shortcut? Suggest an edit on GitHub — every accepted fix goes live on this page, the API and the CLI.