Key | Mode |
---|---|
i |
Insert |
Esc |
Normal |
v |
Visual |
: |
Command-line |
Key | Action |
---|---|
h j k l |
Left, Down, Up, Right |
w / b |
Next / prev word |
0 / $ |
Start / end of line |
gg / G |
First / last line |
Key | Action |
---|---|
i / a |
Insert before / after |
o / O |
New line below / above |
x |
Delete character |
dd |
Delete line |
yy |
Copy line |
p / P |
Paste after / before |
Command | Action |
---|---|
/pattern |
Search forward |
?pattern |
Search backward |
n / N |
Next / previous occurrence |
:%s/old/new/g |
Replace all 'old' with 'new' |
Command | Action |
---|---|
:w |
Save |
:q |
Quit |
:wq or :x |
Save and quit |
:q! |
Force quit |
Command | Action |
---|---|
:e filename |
Edit file in buffer |
:bn / :bp |
Next / prev buffer |
:bd |
Close buffer |
Command | Action |
---|---|
:split filename |
Split horizontally |
:vsplit filename |
Split vertically |
Ctrl-w w |
Switch windows |
Ctrl-w q |
Close window |
Key | Object |
---|---|
iw |
Inner word |
it |
Inner tag |
i" |
Inner quotes |
ip |
Inner paragraph |
Key | Action |
---|---|
u |
Undo |
Ctrl-r |
Redo |
. |
Repeat last cmd |
> / < |
Indent right/left |
- Practice in Normal mode
- Combine commands (e.g.,
dw
) - Use
:help
for documentation - Customize your
.vimrc