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) |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access