Command-Line Options
Command | Action |
---|---|
vi
file | Invoke vi on file |
vi file1
file2 | Invoke vi on files sequentially |
view
file | Invoke vi on file in read-only mode |
vi -R
file | Invoke vi on file in read-only mode |
vi -r
file | Recover file and recent edits after a crash |
vi -t
tag | Look up tag and start editing at its definition |
vi -w
n | Set the window size to n; useful over a slow connection |
vi +
file | Open file at last line |
vi + n
file | Open file directly at line number n |
vi -c
command file | Open file, execute command, which is usually a search command or line number (POSIX) |
vi
+/ pattern
file | Open file directly at pattern |
ex
file | Invoke ex on file |
ex -
file <
script | Invoke ex on file, taking commands from script; suppress informative messages and prompts |
ex -s
file <
script | Invoke ex on file, taking commands from script; suppress informative messages and prompts (POSIX) |
Get vi and Vim Editors Pocket Reference, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.