Interactive Vim Shortcuts Tutorial

Master Vim with categorized shortcuts and easy navigation

Basics & Movement

Basic Movement

h/j/k/l Move left/down/up/right
w/b Move forward/backward by word
e/ge Move to end of word forward/backward
W/B/E Move by WORD (whitespace-separated)

Line Navigation

0 Jump to beginning of line
$ Jump to end of line
^ Jump to first non-blank character
g_ Jump to last non-blank character

File Navigation

gg Go to first line
G Go to last line
:{number} Go to line number
Ctrl+d/u Scroll down/up half page

Character Navigation

f{char} Jump to next occurrence of character
F{char} Jump to previous occurrence of character
t{char} Jump to before next occurrence
T{char} Jump to after previous occurrence
; Repeat last f/F/t/T command
, Repeat last f/F/t/T in opposite direction
💡 Movement Tip
Use numbers with movement commands! 3w moves 3 words forward, 5j moves 5 lines down.

Essential Editing

Insert Mode

i Insert before cursor
a Insert after cursor
I Insert at beginning of line
A Insert at end of line
o Open new line below
O Open new line above

Delete Operations

x Delete character under cursor
X Delete character before cursor
dd Delete entire line
dw Delete word
d$ Delete to end of line
d0 Delete to beginning of line

Copy & Paste

yy Copy (yank) entire line
yw Copy word
y$ Copy to end of line
p Paste after cursor
P Paste before cursor

Undo & Redo

u Undo
Ctrl+r Redo
U Undo all changes on current line
Example Workflow:
dd → delete current line
3dd → delete 3 lines
yy → copy line
p → paste below
u → undo if needed

Text Objects

Word Objects

iw Inner word (without surrounding whitespace)
aw A word (with surrounding whitespace)
iW Inner WORD (non-whitespace sequence)
aW A WORD (with surrounding whitespace)

Bracket Objects

i( / i) / ib Inside parentheses
a( / a) / ab Around parentheses (including brackets)
i[ / i] Inside square brackets
a[ / a] Around square brackets
i{ / i} / iB Inside curly braces
a{ / a} / aB Around curly braces
i< / i> Inside angle brackets
a< / a> Around angle brackets

Quote Objects

i" Inside double quotes
a" Around double quotes (including quotes)
i' Inside single quotes
a' Around single quotes
i` Inside backticks
a` Around backticks

Sentence & Paragraph Objects

is Inner sentence
as A sentence (with trailing whitespace)
ip Inner paragraph
ap A paragraph (with surrounding blank lines)

Tag Objects (HTML/XML)

it Inside tag
at Around tag (including the tags)
💡 Text Objects Tip
Text objects are used with operators! Try ciw (change inner word), di" (delete inside quotes), or ya{ (yank around braces).

Operators

Basic Operators

d Delete
c Change (delete and enter insert mode)
y Yank (copy)
v Visual select

Case Operators

g~ Toggle case
gu Make lowercase
gU Make uppercase

Formatting Operators

= Auto-indent
> Indent right
<< /span> Indent left
! Filter through external command
Operator + Text Object Examples:
ciw → change inner word
di" → delete inside quotes
ya{ → yank around braces
=ip → auto-indent paragraph
gUiw → make word uppercase
>i{ → indent inside braces

Visual Mode

Visual Mode Types

v Visual mode (character selection)
V Visual line mode
Ctrl+v Visual block mode
gv Reselect last visual selection

Visual Mode Operations

d Delete selected text
y Yank (copy) selected text
c Change selected text
> Indent selection
<< /span> Unindent selection
u/U Make selection lowercase/uppercase

Command Mode

File Operations

:w Save file
:q Quit
:wq / ZZ Save and quit
:q! / ZQ Quit without saving
:e filename Edit file
:w filename Save as filename

Window Management

:split / :sp Split window horizontally
:vsplit / :vsp Split window vertically
Ctrl+w w Switch between windows
Ctrl+w h/j/k/l Move between split windows
Ctrl+w q Close current window

Buffer Management

:bn / :bnext Next buffer
:bp / :bprev Previous buffer
:bd Delete (close) buffer
:ls List all buffers

Advanced

Repeat & Macros

. Repeat last command
q{letter} Start recording macro
q Stop recording macro
@{letter} Play macro
@@ Repeat last macro

Marks & Jumps

m{letter} Set mark
'{letter} Jump to mark (line)
`{letter} Jump to mark (exact position)
'' Jump back to previous position
Ctrl+o / Ctrl+i Navigate jump list backward/forward

Screen Control

zz Center current line on screen
zt Move current line to top
zb Move current line to bottom
Ctrl+e / Ctrl+y Scroll down/up one line

Special Characters

~ Toggle case of character
J Join line below to current line
Ctrl+a Increment number
Ctrl+x Decrement number

Power Combinations

Change Operations

ciw Change inner word
ci" Change inside quotes
ci( Change inside parentheses
cit Change inside HTML tag
cis Change inner sentence
cap Change around paragraph

Delete Operations

diw Delete inner word
di" Delete inside quotes
da{ Delete around curly braces
dit Delete inside HTML tag
dap Delete around paragraph

Yank Operations

yiw Yank inner word
yi" Yank inside quotes
ya{ Yank around curly braces
yit Yank inside HTML tag
yap Yank around paragraph

Advanced Combinations with Numbers

d3w Delete 3 words
c2j Change current line plus 2 below
y4l Yank 4 characters to the right
3dd Delete 3 lines
5yy Yank 5 lines
=3} Auto-indent 3 paragraphs
Pro Workflow Examples:
1. Change function name: f( → bi → ciw → type new name
2. Duplicate line: yy → p
3. Delete function: di{ → delete inside braces
4. Change HTML content: cit → change inside tag
5. Fix indentation: =ap → auto-indent paragraph
🚀 Master's Tip
The real power is combining operators + text objects + counts. Practice d2aw (delete 2 words), c3is (change 3 sentences), y4ap (yank 4 paragraphs). Once this becomes muscle memory, you'll edit at the speed of thought!