1、字符粒度的移動
快捷鍵 | 助記 | 作用 |
---|---|---|
h | 向左移動一個字符 | |
l | 向右移動一個字符 | |
n| | 移動到文本行的第n列 | |
fX | **f**ind | 移動到光標後面的下一個字符X(X可以是任何字符) |
FX | **F**ind | 移動到光標前面的上一個字符X(X可以是任何字符)(f、F會將光標定位在字符X上) |
tX | **t**ill | 移動到光標後面的下一個字符X(X可以是任何字符) |
TX | **T**ill | 移動到光標前面的上一個字符X(X可以是任何字符)(和上面的f、F類似,區別就是光標定位在X字符之前) |
2、單詞粒度的移動
快捷鍵 | 助記 | 作用 |
---|---|---|
w | **w**ord | 下一個單詞 |
W | **w**ord | 同上,會忽略一些標點符號 |
b | **b**ackward | 上一個單詞 |
B | **b**ackward | 同上,會忽略一些標點符號 |
e | **e**nd | 移動到單詞的末尾 |
E | **E**nd | 同上,但是會忽略一寫標點符號 |
n | **n**ext | 移動到下一次搜索匹配的位置(next matching search pattern) |
N | **N**ext | 移動到上一次搜索匹配的位置(previous matching search pattern) |
* | 移動到下一次出現光標下單詞的位置(next whole word under cursor) | |
# | 移動到上一次出現光標下單詞的位置(previous whole word under cursor) | |
g* | next matching search (not whole word) pattern under cursor | |
g# | previous matching search (not whole word) pattern under cursor(g*、g#和*、#的區別,這裏暫不解釋) |
3、基於行的移動
快捷鍵 | 助記 | 作用 |
---|---|---|
j | 向下移動一文本行 | |
k | 向上移動一文本行 | |
gj | 向下移動一屏幕行 | |
gk | 向上移動一屏幕行 | |
0 | 移動到文本行的開頭 | |
$ | 移動到文本行的末尾 | |
^ | 移動到文本行的第一個非空白字符 | |
_ |
移動到文本行的第一個非空白字符(move to first non-blank character of the line) | |
g_ |
移動到文本行的最後一個非空白字符(move to last non-blank character of the line) | |
gg | 移動到第一行 | |
G | 移動到最後一行 | |
nG | 或者是 ngg 移動到第n行 | |
:n | 移動到第n行 | |
nH | **H**igh | 移動到屏幕頂端往下的第n行 |
nL | **L**ow | 移動到屏幕頂端往上的第n行 |
4、 基於錨點的移動
快捷鍵 | 助記 | 作用 |
---|---|---|
o | 在選中區域的兩端交替移動光標 | |
% | 在括號兩端交替移動(會先找到在同一行的括號,然後,在括號的兩端交替移動)(jump to matching bracket {}, [], ()) | |
) | 移至下一個句子(sentence)首。(Jump forward one sentence.) | |
( | 移至上一個句子(sentence)首。sentence(句子)是以.!?爲分隔。(Jump backward one sentence.) | |
} | 移至下一個段落(paragraph)首。(Jump forward one paragraph.) | |
{ | 移至上一個段落(paragraph)首。paragraph(段落)是以空白行爲分隔。(Jump backward one paragraph.) | |
m{a-zA-Z} | **m**ark | 用m{a-zA-Z}標記該位置 |
`{a-zA-Z} | 光標移動到之前用{a-zA-Z}標記的位置 | |
‘{a-zA-Z} | 光標移動到之前用{a-zA-Z}標記的位置所在行的行首 |
5、基於屏幕的移動
快捷鍵 | 助記 | 作用 |
---|---|---|
Ctrl+u | **u**p | 向上半屏 |
Ctrl+d | **d**own | 向下半屏 |
Ctrl+b | **b**ackward | 向上半屏 |
Ctrl+f | **f**orward | 向下半屏 |
H | **H**igh | 移動光標到屏幕頂端(move to top of screen) |
M | **M**iddle | 移動光標到屏幕中央(move to middle of screen) |
L | **L**ow | 移動光標到屏幕底端(move to bottom of screen) |
6、基於歷史的移動
快捷鍵 | 助記 | 作用 |
---|---|---|
Ctrl+o | **o**lder | 光標回到之前的位置(jump to last (older) cursor position) |
Ctrl+i | 光標回到之後的位置(之前有ctrl+o操作)(jump to next cursor position (after Ctrl+o)) | |
; | 重複上次的f、t、F和T移動操作(以相同的方向) | |
, | 重複上次的f、t、F和T移動操作(以相反的方向) | |
“ | 移動到上次光標所在的位置(多次的效果就是在最近的光標位置之間交替移動)(Return to the cursor position before the latest jump (undo the jump).) | |
” | 移動到之前光標位置所在的行(Return to the line where the cursor was before the latest jump.) | |
‘. | 移動到上次修改的行(Jump to the last-changed line.) | |
gv | **v**isual | 移動到上次選中的位置,並選中上次選中的內容 |
7、光標所在的位置不變,改變文本相對屏幕的位置
快捷鍵 | 助記 | 作用 |
---|---|---|
zz | 將光標所在的行移動到屏幕中央 | |
Ctrl+y | 光標位置不變,屏幕內容向下移動一行(move view pane up) | |
Ctrl+e | 光標位置不變,屏幕內容向上移動一行(move view pane down) | |
zh | 左移屏幕內容(如果設置了nowrap,並且文本行超出屏幕) | |
zl | 右移屏幕內容(如果設置了nowrap,並且文本行超出屏幕) | |
z. | 將光標所在行移動到屏幕中間(scroll the line with the cursor to the center of the screen) | |
zt | **t**op | 將光標所在行移動到屏幕頂端(scroll the line with the cursor to the top) |
z | 將光標所在行移動到屏幕頂端 | |
z- | 將光標所在行移動到屏幕底端 | |
zb | **b**ottom | 將光標所在行移動到屏幕底端(scroll the line with the cursor to the bottom) |
8、其他快捷鍵
快捷鍵 | 助記 | 作用 |
---|---|---|
Ctrl+g | 顯示當前行的信息 |