Vim Shortcuts for Windows

Keyboard shortcuts for Vim on Windows. Covers motions, insert mode, editing, registers, visual mode, macros, windows, and search and replace.
Key label style

Left-right motions

Move left
H
Move right
L
Move to the first character of the line
0
Move to the first non-blank character of the line
Shift+6
Move to the last character of the line
Shift+4
Move to the first character of the screen lineDiffers from 0 when the line wraps.
G,0
Move to the first non-blank character of the screen lineDiffers from the first-non-blank motion when the line wraps.
G,Shift+6
Move to the last character of the screen lineDiffers from the end-of-line motion when the line wraps.
G,Shift+4
Move to the middle of the screen line
G,M
Move to the middle of the line
G,Shift+M
Jump to a specific columnType a count first, e.g. 10| jumps to column 10.
Shift+\
Jump to the next occurrence of a characterPress f, then the target character.
F
Jump to the previous occurrence of a characterPress F, then the target character.
Shift+F
Jump before the next occurrence of a characterPress t, then the target character.
T
Jump before the previous occurrence of a characterPress T, then the target character.
Shift+T
Repeat the last f, F, t, or T search, opposite direction
,

Up-down motions

Move up
K
Move down
J
Move up, to the first non-blank character
-
Move down, to the first non-blank character
Shift+=
Move down N-1 lines, to the first non-blank character
Shift+-
Go to a line (default is the last line)
Shift+G
Go to a line (default is the first line)
G,G
Go to a percentage through the fileType a count first, e.g. 50% goes halfway through the file.
Shift+5
Move up a screen lineDiffers from k when the line wraps.
G,K
Move down a screen lineDiffers from j when the line wraps.
G,J

Text object motions

Move forward a word
W
Move forward a WORDA WORD is separated by whitespace only, and can contain punctuation.
Shift+W
Move forward to the end of a word
E
Move forward to the end of a WORD
Shift+E
Move backward a word
B
Move backward a WORD
Shift+B
Move backward to the end of a word
G,E
Move backward to the end of a WORD
G,Shift+E
Move forward a sentence
Shift+0
Move backward a sentence
Shift+9
Move forward a paragraph
Shift+]
Move backward a paragraph
Shift+[
Move forward to the start of the next section
],]
Move backward to the start of the previous section
[,[
Move forward to the end of a section
],[
Move backward to the end of the previous section
[,]

Pattern searches

Search forwardType the pattern, then press Enter.
/
Search backwardType the pattern, then press Enter.
Shift+/
Repeat the last search, opposite direction
Shift+N
Search forward for the word under the cursor
Shift+8
Search backward for the word under the cursor
Shift+3
Search forward for the word under the cursor, matching part of it too
G,Shift+8
Search backward for the word under the cursor, matching part of it too
G,Shift+3
Go to the local declaration of the identifier under the cursor
G,D
Go to the global declaration of the identifier under the cursor
G,Shift+D

Marks and motions

Set a mark at the cursor positionPress m, then a letter to name the mark.
M
Jump to a mark's exact positionPress the backtick key, then the mark's letter.
`
Jump to a mark's line, at its first non-blank characterPress ', then the mark's letter.
'
Jump to the position before the last jump
`,`
Jump to the position when the file was last edited
`,Shift+'
Jump to the position of the last change
`,.
Jump to the start of the last change or put
`,[
Jump to the end of the last change or put
`,]
Jump to the start of the last Visual selection
`,Shift+,
Jump to the end of the last Visual selection
`,Shift+.
Go to an older position in the jump list
Ctrl+O
Go to a newer position in the jump list
Ctrl+I

Using tags

Jump to the tag under the cursor
Ctrl+]
Jump back from an older tag
Ctrl+T

Scrolling

Scroll the window down one line
Ctrl+E
Scroll the window up one line
Ctrl+Y
Scroll the window down half a page
Ctrl+D
Scroll the window up half a page
Ctrl+U
Scroll the window down a full page
Ctrl+F
Scroll the window up a full page
Ctrl+B
Redraw, current line at the top of the window
Z,T
Redraw, current line at the center of the window
Z,Z
Redraw, current line at the bottom of the window
Z,B
Scroll the screen right
Z,H
with 'wrap' off
Scroll the screen left
Z,L
with 'wrap' off
Scroll the screen half a screen-width right
Z,Shift+H
with 'wrap' off
Scroll the screen half a screen-width left
Z,Shift+L
with 'wrap' off

Inserting text

Insert text before the cursor
I
Insert text before the first non-blank character of the line
Shift+I
Append text after the cursor
A
Append text at the end of the line
Shift+A
Insert text in column 1
G,Shift+I
Open a new line below the current line and insert text
O
Open a new line above the current line and insert text
Shift+O

Insert mode keys

End Insert mode, back to Normal mode
Esc
End Insert mode without triggering an abbreviation
Ctrl+C
Execute one command, then return to Insert mode
Ctrl+O
Move one word left or right
Shift+Left
or
Shift+Right
Move one screenful backward or forward
Shift+Up
or
Shift+Down
Move the cursor after the last character in the line
End
Move the cursor to the first character in the line
Home

Special keys in Insert mode

Insert a character literally, or a decimal byte value
Ctrl+V
Begin a new line
Enter
Insert the character from the line below the cursor
Ctrl+E
Insert the character from the line above the cursor
Ctrl+Y
Insert previously inserted text
Ctrl+A
Insert the contents of a registerPress Ctrl+R, then the register's letter.
Ctrl+R
Insert the next matching completion of the identifier before the cursor
Ctrl+N
Insert the previous matching completion of the identifier before the cursor
Ctrl+P
Delete the character before the cursor
Bksp
Delete the character under the cursor
Del
Delete the word before the cursor
Ctrl+W
Delete all entered characters on the current line
Ctrl+U
Insert one shiftwidth of indent in front of the current line
Ctrl+T
Delete one shiftwidth of indent in front of the current line
Ctrl+D
Delete all indent in the current line
0,Ctrl+D
Delete all indent in the current line, restore it on the next line
Shift+6,Ctrl+D

Deleting text

Delete the character under and after the cursor
X
Delete the character before the cursor
Shift+X
Delete the text covered by a motionPress d, then a motion, e.g. dw deletes to the next word.
D
Delete the current line
D,D
Delete to the end of the line
Shift+D
Join the current line with the next
Shift+J
Join the current line with the next, without adding a space
G,Shift+J

Copying and moving text

Select a register for the next delete, yank, or putPress the double-quote character, then the register's letter.
Shift+'
Yank the text covered by a motion into a registerPress y, then a motion, e.g. yw yanks to the next word.
Y
Yank the current line into a register
Y,Y
Put a register after the cursor
P
Put a register before the cursor
Shift+P
Put a register after the cursor, adjusting the indent
],P
Put a register before the cursor, adjusting the indent
[,P
Put a register after the cursor, leave the cursor after the new text
G,P
Put a register before the cursor, leave the cursor after the new text
G,Shift+P

Changing text

Replace a single characterPress r, then the replacement character.
R
Enter Replace mode
Shift+R
Change the text covered by a motionPress c, then a motion, e.g. cw changes to the next word.
C
Change the current line
C,C
Change to the end of the line
Shift+C
Switch the case of a character
Shift+`
Switch the case of the text covered by a motionPress g~, then a motion, or use in Visual mode.
G,Shift+`
Make the text covered by a motion lowercasePress gu, then a motion, or use in Visual mode.
G,U
Make the text covered by a motion uppercasePress gU, then a motion, or use in Visual mode.
G,Shift+U
Perform rot13 encoding on the text covered by a motionPress g?, then a motion, or use in Visual mode.
G,Shift+/
Add to the number at or after the cursor
Ctrl+A
Subtract from the number at or after the cursor
Ctrl+X
Move lines one shiftwidth leftPress <, then a motion, e.g. << shifts the current line.
Shift+,
Move the current line one shiftwidth left
Shift+,,Shift+,
Move lines one shiftwidth rightPress >, then a motion, e.g. >> shifts the current line.
Shift+.
Move the current line one shiftwidth right
Shift+.,Shift+.

Visual mode

Start highlighting characters
V
Start highlighting whole lines
Shift+V
Start highlighting a block
Ctrl+V
Exchange the cursor position with the start of highlighting
O
Resume the last Visual selection
G,V

Text objects

Only meaningful in Visual mode or right after an operator, e.g. daw deletes a word.

A word
A,W
Inner word
I,W
A WORD
A,Shift+W
Inner WORD
I,Shift+W
A sentence
A,S
Inner sentence
I,S
A paragraph
A,P
Inner paragraph
I,P
A parenthesized block
A,B
Inner parenthesized block
I,B
A brace block
A,Shift+B
Inner brace block
I,Shift+B
A tag block
A,T
Inner tag block
I,T
A single-quoted string
A,'
Inner single-quoted string
I,'
A backward-quoted string
A,`
Inner backward-quoted string
I,`
A <> block
A,Shift+.
Inner <> block
I,Shift+.
A double-quoted string
A,Shift+'
Inner double-quoted string
I,Shift+'

Repeating commands

Repeat the last change
.
Record typed characters into a registerPress q, then a letter to name the register (a capital letter appends instead of overwriting). Press q again to stop.
Q
Execute the contents of a registerPress @, then the register's letter.
Shift+2
Repeat the previous register execution
Shift+2,Shift+2

Undo/Redo commands

Undo the last change
U
Redo the last undone change
Ctrl+R
Restore the last changed line
Shift+U

Various commands

Clear and redraw the screen
Ctrl+L
Show the current file name and cursor position
Ctrl+G
Show the ASCII value of the character under the cursor
G,A
Show the UTF-8 byte sequence for the character under the cursor
G,8
Show the cursor's column, line, and character position
G,Ctrl+G
Look up the keyword under the cursor
Shift+K
Switch to Ex mode
Shift+Q
Edit the file named under the cursor
G,F

Command-line editing

Abandon the command line
Esc
Insert a character literally
Ctrl+V
Insert the contents of a registerPress Ctrl+R, then the register's letter.
Ctrl+R
Move the cursor one word left or right
Shift+Left
or
Shift+Right
Move the cursor to the beginning of the command line
Ctrl+B
Move the cursor to the end of the command line
Ctrl+E
Delete the character before the cursor
Bksp
Delete the character under the cursor
Del
Delete the word before the cursor
Ctrl+W
Remove all characters on the command line
Ctrl+U
Recall an older command line starting with the current text
Up
Recall a newer command line starting with the current text
Down
Recall an older command line from history
Shift+Up
Recall a newer command line from history
Shift+Down
Complete the pattern in front of the cursor
Tab
List all names matching the pattern in front of the cursor
Ctrl+D

Multi-window commands

Split the window
Ctrl+W,S
Create a new empty window
Ctrl+W,N
Quit editing and close the window
Ctrl+W,Q
Make the buffer hidden and close the window
Ctrl+W,C
Make the current window the only one on the screen
Ctrl+W,O
Move the cursor to the window below
Ctrl+W,J
Move the cursor to the window above
Ctrl+W,K
Move the cursor to the next window
Ctrl+W,Ctrl+W
Move the cursor to the top window
Ctrl+W,T
Move the cursor to the bottom window
Ctrl+W,B
Move the cursor to the previous active window
Ctrl+W,P
Rotate windows downwards
Ctrl+W,R
Rotate windows upwards
Ctrl+W,Shift+R
Exchange the current window with the next one
Ctrl+W,X
Make all windows equal height and width
Ctrl+W,=
Decrease the current window height
Ctrl+W,-
Increase the current window height
Ctrl+W,Shift+=
Set the current window height
Ctrl+W,Shift+-
Decrease the current window width
Ctrl+W,Shift+,
Increase the current window width
Ctrl+W,Shift+.
Set the current window width
Ctrl+W,Shift+\

Folding

Define a fold manuallyPress zf, then a motion to cover the lines.
Z,F
Delete one fold under the cursor
Z,D
Delete all folds under the cursor
Z,Shift+D
Open one fold under the cursor
Z,O
Open all folds under the cursor
Z,Shift+O
Close one fold under the cursor
Z,C
Close all folds under the cursor
Z,Shift+C
Decrease the fold level
Z,M
Close all folds
Z,Shift+M
Increase the fold level
Z,R
Open all folds
Z,Shift+R
Disable folding
Z,N
Enable folding
Z,Shift+N
Toggle folding
Z,I

Writing and quitting

Write the current file
":w"
Write the current file and exit
":wq"
Write the current file and exit (shorthand)
Shift+Z,Shift+Z
Quit the current windowFails if there are unsaved changes.
":q"
Quit the current window, discarding changes
Shift+Z,Shift+Q
Exit Vim, unless changes have been made
":qa"
Exit Vim, discarding all changes
":qa!"

Intro

Vim isn't bundled with Windows the way it is with macOS and Linux. Git for Windows installs a working vim in Git Bash, and gVim (the GUI build) is a separate download, but every shortcut on this page behaves the same once you're in either one.

Windows-specific shortcut notes

Getting Vim on Windows. Git Bash (installed with Git for Windows) ships a real vim, not just vi. gVim adds a native Windows GUI with menus, but the keyboard shortcuts on this page are identical either way.

Watch Ctrl+S. In some Windows terminals, Ctrl+S triggers terminal flow control (XOFF) instead of reaching Vim, which can make the editor look frozen. gVim and most modern terminal apps don't have this problem, but Vim itself doesn't bind Ctrl+S to anything by default anyway.

Case matters more than the modifier. Almost every shortcut here is a bare letter or Shift+letter, not a Ctrl or Alt chord, dd and D are different commands, not the same one with an optional modifier.

Printable PDF

The Vim Windows shortcut list is available as a printable PDF. The motions, operators, and text objects are worth learning first.

FAQ

Need more than shortcuts?
Visit the Vim app page for an overview and helpful links.

Want to suggest a new app, report a bug, or get help? Email us at info@hkeys.app.

For anything else or just a quick hello, write to us at info@hkeys.app.