Vim Shortcuts & Commands
Essential Vim shortcuts for navigation, editing, search, and split windows
Your data never leaves the browser — all processing is done locally 0 server requests
Mode Switching, Saving & Quitting
Press Esc in insert mode to return to normal mode. Commands starting with : are entered in normal mode.
-
iEnter insert mode before the cursor (a inserts after)
-
oOpen a new line below and enter insert mode (O opens above)
-
:wSave the file (:w filename to save as a different name)
-
:qQuit (fails if there are unsaved changes)
-
:wqSave and quit (same as ZZ)
-
:q!Force quit without saving
-
:e 파일명Open a different file
Cursor Movement
-
h j k lMove left, down, up, right
-
w / bJump to next word start / previous word start (e goes to word end)
-
0 / ^ / $Go to line start / first non-blank character / line end
-
gg / GJump to the beginning / end of the file
-
:42Go to line 42 (42G works the same)
-
Ctrl+f / Ctrl+bScroll one page down / up
-
{ / }Move by paragraph
-
%Jump to the matching bracket
Editing — Delete, Copy & Paste
-
xDelete the character under the cursor
-
ddDelete the current line (3dd deletes 3 lines)
-
dw / d$Delete a word / delete to end of line
-
yyYank (copy) the current line (3yy copies 3 lines)
-
p / PPaste below / above the cursor
-
uUndo (Ctrl+r to redo)
-
r글자Replace the character under the cursor with another
-
ciwDelete the word under the cursor and enter insert mode (cw, cc also useful)
-
>> / <<Indent / un-indent the current line
-
.Repeat the last change
-
JJoin the line below to the current line
Search & Replace
-
/검색어Search forward (?pattern searches backward)
-
n / NJump to next / previous search match
-
*Search for the word under the cursor
-
:%s/old/new/gReplace all occurrences of old with new in the entire file
-
:%s/old/new/gcReplace interactively with confirmation for each match (y/n)
-
:10,20s/old/new/gReplace only within lines 10 to 20
-
:nohClear search highlighting
Visual Mode (Selection)
-
vStart character-wise selection
-
VStart line-wise selection
-
Ctrl+vStart block (column) selection for editing multiple lines at once
-
ggVGSelect the entire file
-
y / dYank (copy) / delete the selection
-
gu / gUConvert selection to lowercase / uppercase
Split Windows, Tabs & Misc
-
:sp / :vspSplit the window horizontally / vertically
-
Ctrl+w h j k lNavigate between split windows
-
:tabnewOpen a new tab (gt / gT to switch tabs)
-
:set nuShow line numbers (:set nonu to hide)
-
:set pasteDisable auto-indent to prevent paste corruption
-
qa … q 후 @aRecord a macro into register a and replay it (5@a plays 5 times)
-
:!ls -alRun a shell command without leaving Vim
Vim Shortcuts: Think in Verbs and Objects
Vim commands combine verbs (d = delete, c = change, y = yank/copy) and text objects (w = word, $ = end of line, iw = inner word). Knowing a few verb-object combinations like dd, ciw, and y$ dramatically reduces what you need to memorize.
For quick server-side edits, five commands cover most cases: i (insert mode), Esc (return to Normal), :wq (save and quit), /search (search forward), and u (undo).
To go further, learn the . (repeat last change), :%s/old/new/g (global substitution), and macros for repetitive tasks. These three unlock a significant speed boost.
FAQ
- How do I exit Vim?
- Press Esc to ensure you are in Normal mode, then type :wq and press Enter to save and quit, or :q! to quit without saving. This is the most famous question in programming — now you know the answer.
- Pasting text causes messy indentation. How do I fix it?
- Auto-indent gets applied on top of pasted content. Before pasting, type :set paste to disable auto-indent, paste your text, then type :set nopaste to restore normal mode.
- How do I repeat an action across multiple lines?
- Use Ctrl+v for visual block selection to edit multiple lines at once. Alternatively, record a macro with qa (start recording to register a), perform your actions, then press q (stop), and replay with @a or 10@a (repeat 10 times).