Browse all keyboard shortcut cheat sheets

Vim Keyboard Shortcuts (8.x / NeoVim) — Complete Cheat Sheet

The essential Vim cheat sheet — modes, navigation, editing, search, and file operations for Vim and NeoVim.

66 shortcuts across 5 categories · Linux · macOS · Windows

Vim is a powerful terminal-based text editor whose modal keyboard system makes it uniquely fast for editing code and text files once mastered. Unlike graphical editors, Vim is designed to be operated entirely from the keyboard — every operation, from navigation to complex text manipulation, has a dedicated key sequence.

Modes

ActionShortcutDescription
Enter Normal Mode Esc or Ctrl + [ Return to Normal mode from any other mode — the home base
Enter Insert Mode I Insert before the cursor
Insert at Line Start Shift + I Move to the first non-blank character of the line and enter Insert mode
Append After Cursor A Enter Insert mode after the cursor position
Append at Line End Shift + A Move to the end of the line and enter Insert mode
Open New Line Below O Insert a new line below the cursor and enter Insert mode
Open New Line Above Shift + O Insert a new line above the cursor and enter Insert mode
Replace Single Character R Replace one character under the cursor, then return to Normal mode
Visual Mode V Enter character-wise Visual mode to select text
Visual Line Mode Shift + V Enter line-wise Visual mode to select whole lines
Visual Block Mode Ctrl + V Enter block-wise Visual mode for rectangular selections
Command Mode : Open the command line to enter Ex commands like :w, :q, :s

Navigation

ActionShortcutDescription
Move Left H Move cursor one character to the left
Move Down J Move cursor one line down
Move Up K Move cursor one line up
Move Right L Move cursor one character to the right
Next Word Start W Jump to the start of the next word
Previous Word Start B Jump to the start of the previous word
Word End E Jump to the end of the current or next word
Line Start (non-blank) ^ Jump to the first non-blank character on the current line
Line End $ Jump to the end of the current line
Start of File G + G Jump to the first line of the file
End of File Shift + G Jump to the last line of the file
Go to Line Number : + n Jump to line n (e.g. :42 goes to line 42)
Page Down Ctrl + F Scroll one full page down
Page Up Ctrl + B Scroll one full page up
Half Page Down Ctrl + D Scroll half a page down
Half Page Up Ctrl + U Scroll half a page up

Editing

ActionShortcutDescription
Delete Character X Delete the character under the cursor
Delete Line D + D Delete (cut) the entire current line
Delete to End of Line D + $ or Shift + D Delete from the cursor to the end of the line
Change Word C + W Delete the current word and enter Insert mode
Change Line C + C or Shift + C Delete the current line and enter Insert mode
Yank (Copy) Line Y + Y Copy the entire current line to the clipboard buffer
Yank Word Y + W Copy the current word to the clipboard buffer
Paste After P Paste the contents of the buffer after the cursor
Paste Before Shift + P Paste the contents of the buffer before the cursor
Undo U Undo the last change
Redo Ctrl + R Redo the previously undone change
Repeat Last Command . Repeat the last Normal mode change — one of Vim's most powerful features
Join Lines Shift + J Join the current line with the line below it
Auto-Indent = + = Auto-indent the current line
Indent Right > + > Shift the current line one indent level to the right
Indent Left < + < Shift the current line one indent level to the left

Search & Replace

ActionShortcutDescription
Search Forward / Enter a search pattern to find the next match below the cursor
Search Backward ? Enter a search pattern to find the next match above the cursor
Next Match N Jump to the next search match in the same direction
Previous Match Shift + N Jump to the previous search match
Search Word Under Cursor * Search forward for the exact word under the cursor
Search Word Backward # Search backward for the exact word under the cursor
Substitute in Line :s/old/new Replace the first occurrence of 'old' with 'new' on the current line
Substitute All in File :%s/old/new/g Replace every occurrence of 'old' with 'new' in the entire file
Substitute with Confirm :%s/old/new/gc Replace with confirmation prompt for each match — safest replace option
Clear Search Highlight :noh Remove the search highlight from the screen without clearing the search pattern

Files & Commands

ActionShortcutDescription
Save File :w Write (save) the current file to disk
Quit :q Quit Vim (fails if there are unsaved changes)
Save and Quit :wq or Shift + Z + Shift + Z Save the file and quit Vim
Quit Without Saving :q! Force quit Vim, discarding all unsaved changes
Save All & Quit :wqa Save all open buffers and quit all windows
Open File :e filename Open a file by path (e.g. :e src/main.ts)
Next Buffer :bn Switch to the next open buffer
Previous Buffer :bp Switch to the previous open buffer
Split Horizontally :sp Split the current window horizontally to show two views
Split Vertically :vsp Split the current window vertically for side-by-side editing
Close Window Ctrl + W + Q Close the current split window
Switch Window Ctrl + W + W Cycle focus between split windows

Vim Tips & Tricks

  • . (dot) is the undo of repetitive work: The . key repeats your last change — if you changed a word with cw, deleted a line with dd, or indented with >>, pressing . does it again instantly. This is one of Vim's most powerful efficiency features.
  • Combine operators and motions: Vim's real power is composing commands: d (delete) + w (word) = dw. c (change) + $ (to line end) = c$. y (yank) + gg (start of file) = ygg. Once you understand this grammar, shortcuts multiply.
  • Always return to Normal mode: Vim beginners get stuck by staying in Insert mode. Treat Normal mode as your home — after every edit, press Esc to return. Most navigation and power commands only work in Normal mode.

Frequently Asked Questions — Vim

How do I exit Vim?
Press Esc to ensure you are in Normal mode, then type :q and press Enter to quit (if no unsaved changes). To save and quit, type :wq. To quit without saving, type :q! to force quit.
How do I search for text in Vim?
In Normal mode, press / followed by your search term and Enter to search forward. Press ? to search backward. Use n to jump to the next match and N to go to the previous match.
How do I undo and redo in Vim?
Press u in Normal mode to undo the last change. Press Ctrl+R to redo. Vim has a deep undo history — pressing u multiple times keeps undoing further back.

How to Learn Vim Keyboard Shortcuts

Vim is unlike any other application on this list because its keyboard shortcuts are not a layer on top of the interface — they are the interface itself. Vim operates in distinct modes: Normal mode for navigation and editing commands, Insert mode for typing text, Visual mode for selecting, and Command mode for operations like save and quit. This modal design is what makes Vim intimidating at first and extraordinarily fast once mastered. In Normal mode, every key is a command: h, j, k, l for movement; d for delete; y for yank (copy); p for put (paste); w to jump forward by word; b to jump back. The composability of these commands — pressing d then w deletes a word, d then $ deletes to end of line — gives Vim a precision and expressiveness that most editors can't match.

Learning Vim requires accepting a two-week investment period where productivity drops before it rises. The most effective approach is to install vimtutor (built into every Vim installation — just type vimtutor in a terminal) and complete its interactive lessons. After that, the key habits to build are: staying in Normal mode by default and only entering Insert mode to type, using / for search navigation instead of scrolling, and using . to repeat the last operation. Many developers use Vim's shortcut system without using Vim itself — VS Code's Vim extension, JetBrains' IdeaVim, and browser extensions like Vimium bring Vim's modal navigation to other tools, making the learning investment applicable everywhere.