Vim 명령어 참조서 - 완전한 Vi/Vim 편집기 가이드

Vi/Vim 편집기 명령어와 단축키를 위한 빠른 참조 가이드

이동

h
Move cursor left
j
Move cursor down
k
Move cursor up
l
Move cursor right
w
Move to next word
b
Move to previous word
0
Move to beginning of line
$
Move to end of line
gg
Go to beginning of file
G
Go to end of file
Ctrl+f
Page down
Ctrl+b
Page up

편집

i
Enter insert mode
a
Append after cursor
o
New line below
O
New line above
Esc
Return to normal mode
x
Delete character under cursor
dd
Delete entire line
yy
Copy (yank) line
p
Paste after cursor
u
Undo
Ctrl+r
Redo
r
Replace character

비주얼 모드

v
Visual character mode
V
Visual line mode
Ctrl+v
Visual block mode
y
Yank (copy) selected text
d
Delete selected text
>
Indent selected text
<
Unindent selected text

검색 및 치환

/pattern
Search forward
?pattern
Search backward
n
Next search match
N
Previous search match
:s/old/new
Replace in current line
:%s/old/new/g
Replace all in file
*
Search word under cursor

파일 및 버퍼

:w
Save file
:q
Quit
:wq
Save and quit
:q!
Force quit (discard changes)
:e filename
Open file
:sp
Split window horizontally
:vsp
Split window vertically
Ctrl+w
Switch between windows

고급

.
Repeat last command
q[a-z]
Record macro
@[a-z]
Play macro
:set nu
Show line numbers
:set paste
Enter paste mode
:%!xxd
Switch to hex mode
:!cmd
Execute shell command
ZZ
Save and quit (shortcut)