首页 > 代码库 > vi快捷键收藏
vi快捷键收藏
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显示行号.
vi快捷键收藏