摘要:本文介绍所有的 VIM 关于移动的按键。
参考该文章:http://vim.wikia.com/wiki/All_the_right_moves
Vim provides many ways to move the cursor. Becoming familiar with them leads to more effective text editing.
1 | h move one character left |
举个例子
1 | Vim provides many ways to move the cursor. Becoming familiar w |
当光标在 cursor 的时候,如果使用 w,将会定位到句号,但是当使用 W,将会定位到 B。因为 W 只认为空格是单词分割符。
同理:对于 b 和 B,如果光标在 Becoming 第一个字符,如果使用 b 将会定位到句号,但是 B 将会定位到 cursor
对于 e 和 E,如果光标在 cursor 第一个字符,那么如果使用 e 竟会定位到 r,但是 E 将会定位到句号。
虽然大多数情况下,大写看上去表现一致,但是我们需要知道原因,因为没有其他符号。
All the above movements can be preceded by a count; e.g. 4j moves down 4 lines.
1 | 0 move to beginning of line |
1 | gg move to first line |
See :help {command} (for example, :help g_) for all of the above if you want more details.