VIM (VI Improved) 是 linux 最常见的编辑器之一,功能强大 ,但最让人头疼的也是它的复杂的命令。
这篇文档提供了 VIM 常见的命令的使用:
File and window commands
| :e filename | open a new file | |
| :e! filename | open a new file without saving the current one | |
| :w filename | write buffer to file | |
| :w! filename | write buffer to an existing file | |
| :r filename | read file to buffer | |
| :new | split window and load an empty file | |
| :split | split window | |
| :new filename | open file in a sub window | |
| Ctrlww | Jump to next window | |
| :n | Edit the next file |
Moving by text objects
| h | move the cursor one position left | |
| j | move the cursor one position down | |
| k | move the cursor one position up | |
| l | move the cursor one position right |
| w | move cursor forward to first character of next word | |
| e | move cursor forward to last character of next word | |
| b | move cursor backward to first character of previous word | |
| W | same as w; ignore punctuation | |
| E | same as e; ignore punctuation | |
| B | same as b; ignore punctuation |
| ) | move forward to next sentence beginning | |
| ( | move backward to previous sentence beginning | |
| } | move forward to next paragraph beginning | |
| { | move backward to previous paragraph beginning |
Move to absolute position in a line
| 0 | move cursor to beginning of current line | |
| $ | move cursor to end of current line | |
| ^ | move cursor to first non-space/tab in current line |
Move to absolute position in the file
| G | jump to the end of the file | |
| gg | jump to the beginning of the file | |
| 1G | jump to the beginning of the file | |
| nG | jump to nth line | |
| :n | jump to nth line |
Move by screen
| Ctrlf | move cursor forward by one screen | |
| Ctrlb | move cursor backward by one screen |
Move to absolute position on the screen
| H | move cursor to top line | |
| M | move cursor to middle line | |
| L | move cursor to last line |
Other
| ” | move cursor to previous position | |
| ‘x | mover cursor to marker x, where x is a letter from a to z | |
| % | move cursor to the match of a parethesis, bracket or brace |
| SPACE | move cursor one position right | |
| ENTER | move cursor to beginning of next line |
更多命令,请参考: VIM commands 这篇文档。
本文档介绍了Vim编辑器的基本操作命令,包括文件和窗口操作、文本对象移动、屏幕移动等,帮助用户快速掌握Vim的使用技巧。
8922

被折叠的 条评论
为什么被折叠?



