Vim Cheatsheet

This cheatsheet provides a comprehensive and practical reference for Vim commands, modes, and operations. Use it to quickly look up and learn essential Vim commands.

Basic Movement

h, j, k, l
Mode: Normal
Move left, down, up, right
Basic cursor movement
w
Mode: Normal
Move to start of next word
b
Mode: Normal
Move to start of previous word
e
Mode: Normal
Move to end of word
0
Mode: Normal
Move to start of line
$
Mode: Normal
Move to end of line
gg
Mode: Normal
Move to start of file
G
Mode: Normal
Move to end of file
Ctrl + f
Mode: Normal
Move forward one page
Ctrl + b
Mode: Normal
Move backward one page

Insert Mode

i
Mode: Normal
Insert before cursor
a
Mode: Normal
Insert after cursor
I
Mode: Normal
Insert at start of line
A
Mode: Normal
Insert at end of line
o
Mode: Normal
Insert new line below
O
Mode: Normal
Insert new line above
Esc
Mode: Insert
Exit insert mode

Editing

dd
Mode: Normal
Delete line
yy
Mode: Normal
Copy line
p
Mode: Normal
Paste after cursor
P
Mode: Normal
Paste before cursor
x
Mode: Normal
Delete character under cursor
r
Mode: Normal
Replace character under cursor
u
Mode: Normal
Undo last change
Ctrl + r
Mode: Normal
Redo last undone change
cw
Mode: Normal
Change word
cc
Mode: Normal
Change line

Search & Replace

/pattern
Mode: Normal
Search forward for pattern
?pattern
Mode: Normal
Search backward for pattern
n
Mode: Normal
Find next match
N
Mode: Normal
Find previous match
:%s/old/new/g
Mode: Command
Replace all occurrences
:%s/old/new/gc
Mode: Command
Replace with confirmation
*
Mode: Normal
Search for word under cursor

Visual Mode

v
Mode: Normal
Enter visual mode
V
Mode: Normal
Enter line visual mode
Ctrl + v
Mode: Normal
Enter block visual mode
y
Mode: Visual
Yank (copy) selected text
d
Mode: Visual
Delete selected text
c
Mode: Visual
Change selected text
>
Mode: Visual
Indent right
<
Mode: Visual
Indent left

File Operations

:w
Mode: Command
Save file
:q
Mode: Command
Quit
:wq
Mode: Command
Save and quit
:q!
Mode: Command
Quit without saving
:e filename
Mode: Command
Edit file
:sp filename
Mode: Command
Split window and edit file
:vsp filename
Mode: Command
Vertical split and edit file

Advanced

ma
Mode: Normal
Set mark 'a' at cursor position
'a
Mode: Normal
Jump to mark 'a'
Ctrl + w
Mode: Normal
Window commands prefix
Ctrl + w + h/j/k/l
Mode: Normal
Move to window left/down/up/right
Ctrl + w + s
Mode: Normal
Split window horizontally
Ctrl + w + v
Mode: Normal
Split window vertically
Ctrl + w + c
Mode: Normal
Close current window
Ctrl + w + o
Mode: Normal
Close all other windows
gf
Mode: Normal
Open file under cursor
Ctrl + ]
Mode: Normal
Jump to definition

Categories

  • Basic Movement

    Essential cursor movement commands for navigation.

  • Insert Mode

    Commands for entering and exiting insert mode.

  • Editing

    Text manipulation, deletion, and modification commands.

  • Search & Replace

    Pattern searching and text replacement operations.

  • Visual Mode

    Text selection and manipulation in visual mode.

  • File Operations

    File saving, loading, and window management.

  • Advanced

    Advanced features like marks, windows, and navigation.

Features

  • Quick search functionality
  • Organized by categories
  • Mode-specific commands
  • Common and advanced operations
  • Clear command descriptions
  • Responsive design
  • Perfect for quick reference