0 (digit zero) 数字0Move to beginning of line. 移动光标到行首.
$ Move to end of line. 移动光标到行尾.
[n]w The w command moves the cursor forward one word at a time, counting symbols and punctuation as equivalent to words. w 命令使得光标每次向前移动一个单词的距离,单词不仅仅指英文中的单词,还包括标点符号.
[n]W You can also move by word, not counting symbols and punctuation, using the W command. (You can think of this as a “large” or “capital” Word.) 大写的w命令使得光标每次向前移动一个单词的距离,而这个单词不包括标点符号.
[n]b To move backward by word, use the b command. CapitalB allows you to move backward by word, not counting punctuation. b命令使得光标向后移动一个单词,对应大写的b向后移动光标的单词不包括标点符号.
上面移动单词的命令是指一个单词的距离,如果移动n个单词,就在命令前面加个数字n.
[n]G To move to a specific line, you can use the G command. Plain G goes to the end of the
file, 1G goes to the top of the file, and 42G goes to line 42. 让光标移动到特定的行,那就用G命令吧.G前面的数字就代表那行.
:set nu 让vi显示行号.
c You can replace any text in your file with the change command, c. To tell c how much text to change, you combine c with a movement command. In this way, a movement command serves as a text object for the c command to affect.
c命令可以替换文件中的任何文本.为了表明替换文本的数目,你可以结合移动命令.这样移动命令所影响的文本就是替换命令所影响的那些文本.
cw To the end of a word 所替换的文本是光标所在位置到一个单词的末尾.
c2b Back two words
c$ To the end of line 所替换文本是光标所在位置到行尾文本.
c0 To the beginning of line 所替换文本是光标所在位置到行首文本.
cc To replace the entire current line. It doesn’t matter where the cursor is located on the line. cc 替换光标所在行文本.cc命令和光标所在位置无关.当按下键盘cc后,当前行变空行.
dw deletes a word beginning where the cursor is positioned.