#Mode Switching
| Command | Description | |
|---|---|---|
i | Insert before cursor | |
I | Insert at beginning of line | |
a | Insert after cursor | |
A | Insert at end of line | |
o | Open new line below | |
O | Open new line above | |
Esc | Exit to normal mode | |
v | Visual mode | |
V | Visual line mode | |
Ctrl+v | Visual block mode |
#Editing
| Command | Description | |
|---|---|---|
x | Delete character | |
dd | Delete line | |
dw | Delete word | |
d$ | Delete to end of line | |
D | Delete to end of line | |
yy | Yank (copy) line | |
yw | Yank word | |
p | Paste after cursor | |
P | Paste before cursor | |
u | Undo | |
Ctrl+r | Redo | |
. | Repeat last command | |
r[char] | Replace single character | |
cw | Change word | |
cc | Change entire line | |
C | Change to end of line |
#Search & Replace
| Command | Description | |
|---|---|---|
/pattern | Search forward | |
?pattern | Search backward | |
n | Next search result | |
N | Previous search result | |
:s/old/new | Replace first on line | |
:s/old/new/g | Replace all on line | |
:%s/old/new/g | Replace all in file | |
:%s/old/new/gc | Replace with confirmation | |
:noh | Clear search highlight |
#File Operations
| Command | Description | |
|---|---|---|
:w | Save file | |
:w [filename] | Save as | |
:q | Quit | |
:q! | Quit without saving | |
:wq | Save and quit | |
:x | Save and quit (if changed) | |
ZZ | Save and quit | |
:e [file] | Open file | |
:sp [file] | Horizontal split | |
:vsp [file] | Vertical split | |
Ctrl+w w | Switch windows |
#Visual Mode
| Command | Description | |
|---|---|---|
v + μ΄λ + d | Delete selection | |
v + μ΄λ + y | Yank selection | |
v + μ΄λ + > | Indent selection | |
v + μ΄λ + < | Outdent selection | |
gv | Reselect last selection |
μ΄ ν¬μ€ν μ μΏ ν‘ ννΈλμ€ νλμ μΌνμΌλ‘, μ΄μ λ°λ₯Έ μΌμ μ‘μ μμλ£λ₯Ό μ 곡λ°μ΅λλ€.