Vim Keyboard Shortcuts

Normal, insert, visual and command-line keys for the Vim editor. Every item below is clearly marked as a shortcut, command, or syntax reference.

Most Useful Vim Keyboard Shortcuts

VimShortcut

Insert Before the Cursor

Windows
i

Starts typing at the cursor position.

Learn More
VimShortcut

Leave Insert Mode

Windows
Esc

Goes back to Normal mode.

Learn More
VimShortcut

Delete the Current Line

Windows
dd

Removes the whole line the cursor is on.

Learn More
VimShortcut

Search Forward

Windows
/then Enter

Type the text, then press Enter to search down the file.

Learn More
VimShortcut

Undo

Windows
u

Reverses the last change.

Learn More
VimShortcut

Save the File

Windows
:w then Enter

Writes the file to disk and keeps editing.

Learn More
VimShortcut

Save and Quit

Windows
:wq then Enter

Writes the file and closes Vim.

Learn More
VimShortcut

Move Left or Right

Windows
h/l

Moves the cursor one character at a time.

Learn More

More Vim Keyboard Shortcuts

Vim Shortcuts for Mac

Entries with recorded Mac keys are listed below. Official source links are on each reference page.

TaskTypeShortcut
Insert Before the CursorShortcuti
Leave Insert ModeShortcutEsc
Delete the Current LineShortcutdd
Search ForwardShortcut/then Enter
UndoShortcutu
Save the FileShortcut:w then Enter
Save and QuitShortcut:wq then Enter
Move Left or RightShortcuth/l
Move Down or Up a LineShortcutj/k
Open a Line BelowShortcuto
Copy the Current LineShortcutyy
Start Character SelectionShortcutv
Repeat the SearchShortcutn
Quit Without SavingShortcut:q! then Enter
Move Forward by a WordShortcutw
Go to the Start of the LineShortcut0
Go to the End of the LineShortcut$
Go to the Start of the FileShortcutgg
Go to the End of the FileShortcutG
Scroll Half a Page DownShortcutCtrl+D
Scroll Half a Page UpShortcutCtrl+U
Open a Line AboveShortcutO
Delete the Character Under the CursorShortcutx
Change the Current LineShortcutcc
RedoShortcutCtrl+R
Move Backward by a WordShortcutb
Find a Character on the LineShortcutf{char}/F{char}
Move to the Matching BracketShortcut%
Go to a Line NumberShortcutN G
Delete the Rest of the LineShortcutD
Replace One CharacterShortcutr{char}
Join the Next LineShortcutJ
Search BackwardShortcut? then Enter
Search for the Word Under the CursorShortcut*
Go to the Local DeclarationShortcutgd
Run One Command Without Leaving Insert ModeShortcutCtrl+O
Start Block SelectionShortcutCtrl+V
Move to the End of a WordShortcute
Go to the First Non-blank CharacterShortcut^
Go to the Top, Middle or Bottom of the WindowShortcutH/M/L
Return to the Previous PositionShortcut``
Scroll a Full Page DownShortcutCtrl+F
Scroll a Full Page UpShortcutCtrl+B
Scroll One Line DownShortcutCtrl+E
Scroll One Line UpShortcutCtrl+Y
Centre the Current LineShortcutzz
Move the Current Line to the TopShortcutzt
Append After the CursorShortcuta
Insert at the Start of the LineShortcutI
Append at the End of the LineShortcutA
Delete the Character Before the CursorShortcutX
Change to the End of the LineShortcutC
Switch the Case of a CharacterShortcut~
Paste After the CursorShortcutp
Paste Before the CursorShortcutP
Start Line SelectionShortcutV
Reselect the Previous SelectionShortcutgv
Repeat the Search the Other WayShortcutN
Restore the Whole LineShortcutU
QuitShortcut:q then Enter
Save All Changed FilesShortcut:wall then Enter

Frequently Asked Questions

Which Vim keyboard shortcuts are included?

Examples in this reference include Insert Before the Cursor (i), Leave Insert Mode (Esc), Delete the Current Line (dd), Search Forward (/ then Enter), Undo (u).

Do Vim shortcuts work on a Mac?

Mac key values are listed for 61 of the 61 entries. Use the value shown for the specific action; do not assume Ctrl can be replaced with Cmd. Each reference page links its official source.

What if a Vim task has no keyboard shortcut?

Some reference pages include a menu alternative. When no equivalent is documented here, consult the linked official help rather than assuming a key combination.