Google

Archives

vi/vim command summary

vi/vim command summary

The following tables contain all the basic vi commands.
Starting vi

Command
Description

vi file
start at line 1 of file

vi +n file
start at line n of file

vi + file
start at last line of file

vi +/pattern file
start at pattern in file

vi -r file
recover file after a system crash

Saving files and quitting vi

Command
Description

:e file
edit file (save current file with :w first)

:w
save (write out) the file being edited

:w file
save as file

:w! file
save as an existing file

:q
quit vi

:wq
save the file and [...]

vi, vim 显示行号或行数

在命令模式输入以下命令

1. 显示行号
:set number
2. 取消行号显示
:set nonumber
3. 跳到一特定行 (必须得在命令模式,好像必须每次都得先按Esc键)

回到第一行: G

跳到特定行如99行:  99G

Incoming search terms for the article:vi 显示行数 (25)vim 取消行号 (6)vim 显示行数 (3)vi 显示行号命令 (3)vi 显示行 (3)