Vim 速查表
一份可搜尋、可列印的 Vim 參考:模式、移動、編輯、尋找與取代、視窗、緩衝區和暫存器。免費。
Modes
9Esc
Return to Normal mode
i / a
Insert before / after the cursor
I / A
Insert at start / end of the line
o / O
Open a new line below / above
v
Visual mode (character selection)
V
Visual line mode
Ctrl-v
Visual block mode (columns)
R
Replace mode (overtype)
:
Command-line (Ex) mode
Motions
10h j k l
Left, down, up, right
w / b
Forward / back one word
e / ge
End of next / previous word
0 / ^ / $
Line start / first non-blank / line end
gg / G
First line / last line
42G / :42
Jump to line 42
{ / }
Previous / next paragraph
%
Jump to matching bracket
f x / t x
Move to / before next x on the line
Ctrl-d / Ctrl-u
Scroll half page down / up
Editing operators
11x / X
Delete char under / before cursor
dd / D
Delete line / to end of line
dw / diw
Delete word / inner word
cc / C
Change line / to end of line
ciw / ci"
Change inner word / inside quotes
yy / yw
Yank (copy) line / word
p / P
Paste after / before the cursor
r x / ~
Replace one char / toggle case
u / Ctrl-r
Undo / redo
.
Repeat the last change
>> / <<
Indent / unindent the line
Visual mode
9v / V
Start character / line selection
Ctrl-v
Start block (column) selection
o
Jump to the other end of the selection
d / y
Delete / yank the selection
c
Change the selection
> / <
Indent / unindent the selection
gu / gU
Lowercase / uppercase the selection
gv
Reselect the last visual selection
I / A
Block insert before / append after (Ctrl-v)
Search & replace
9/pattern
Search forward for pattern
?pattern
Search backward for pattern
n / N
Next / previous match
* / #
Search word under cursor fwd / back
:%s/old/new/g
Replace all in the file
:%s/old/new/gc
Replace all with confirmation
:s/old/new/g
Replace all on the current line
:%s/\<word\>/x/g
Replace whole words only
:noh
Clear search highlighting
Windows & tabs
8:sp / :split
Horizontal split
:vsp / :vsplit
Vertical split
Ctrl-w h/j/k/l
Move to the split in that direction
Ctrl-w w
Cycle to the next split
Ctrl-w q / c
Close the current split
Ctrl-w o
Close all other splits
Ctrl-w =
Equalize split sizes
:tabnew / gt / gT
New tab / next / previous tab
Buffers & files
9:e file
Open / edit a file
:w / :w file
Save / save as
:wq / :x / ZZ
Save and quit
:q / :q!
Quit / quit discarding changes
:ls / :buffers
List open buffers
:b name / :bN
Switch to a buffer by name / number
:bn / :bp
Next / previous buffer
:bd
Delete (close) a buffer
:wa / :qa
Write all / quit all
Registers & marks
8"ayy
Yank line into register a
"ap
Paste from register a
"+y / "+p
Yank to / paste from system clipboard
:reg
Show register contents
ma
Set mark a at the cursor
`a / 'a
Jump to mark a (exact / line)
``
Jump back to the previous position
:marks
List all marks
Macros
7qa
Start recording into register a
q
Stop recording
@a
Play back macro a
@@
Repeat the last played macro
5@a
Play macro a five times
:%normal @a
Run macro a on every line
"ap → edit → "ay$
Paste, edit, then re-yank a macro to change it
沒有條目符合「:q」。
關於 Vim 速查表
這份 Vim 小抄依概念整理編輯器功能:模式、移動指令、編輯運算子、視覺模式、搜尋與取代、視窗與分頁、緩衝區與檔案、暫存器與標記,以及巨集。每一列都是一個按鍵或指令,並附上一行說明其作用。
Vim 講究肌肉記憶,而建立肌肉記憶最快的方法,就是在需要時眼前就有正確的移動指令或運算子。此小抄把這些可組合的元件(運算子、移動指令、次數)分組呈現,讓 Vim 的「語法」保持一目了然,而不是逐一死背按鍵。
它免費且完全在用戶端運作:用搜尋框即時篩選每個按鍵,透過固定式目錄在各章節間跳轉,點擊即可複製 Ex 指令,並可列印小抄:搭配紙本列印本來就是學習 Vim 的經典方式。
如何使用 Vim 速查表
- 如果你是新手,先從模式章節開始;若已熟悉,可直接跳到移動指令與編輯運算子。
- 搜尋 delete、replace 或 macro 等動作,即可篩選整份小抄。
- 使用固定式目錄跳到暫存器與標記、視窗與分頁等章節。
- 點擊指令或其複製圖示,即可複製搜尋取代等 Ex 指令。
- 列印小抄放在鍵盤旁,讓這些移動指令逐漸變成肌肉記憶。
常見問題
共九個章節:模式、移動指令、編輯運算子、視覺模式、搜尋與取代、視窗與分頁、緩衝區與檔案、暫存器與標記,以及巨集:涵蓋這款編輯器完整的實用詞彙。
有的。此小抄涵蓋 Vim 的核心行為(模式、移動指令、運算子、暫存器、巨集)這些在 Neovim 中完全相同,因此不論你使用哪一種都適用。
先讀模式章節,了解正常模式、插入模式與視覺模式,再學幾個移動指令與運算子。由於 Vim 的指令可以組合使用,少量詞彙就足以應付大部分編輯工作。
可以。列印按鈕會去除搜尋框與導覽列,只輸出按鍵與說明:紙本 Vim 小抄至今仍是學習的經典方式。
是的,完全免費,可在瀏覽器中搜尋,也能不需帳號直接列印。
熱門搜尋
vim 速查表
vim 指令列表
vim 快速鍵
vim 搜尋與取代
vim 移動指令參考
vim 視覺模式指令
vim 巨集
如何離開 vim
需要協助?
使用此工具時遇到問題?請告訴我們的團隊。