Vim是一个向上兼容Vi的文本编辑器。它可用于编辑各种纯文本。它对编辑程序特别有用。
Examples (TL;DR)
Open a file:
vim path/to/file
Open a file at a specified line number:
vim +line_number path/to/file
View Vim’s help manual:
:help<Enter>
Save and Quit:
:wq<Enter>
Undo the last operation:
u
Search for a pattern in the file (press n/N to go to next/previous match):
/search_pattern<Enter>
Perform a regular expression substitution in the whole file:
:%s/regular_expression/replacement/g<Enter>
Display the line numbers:
:set nu<Enter>