Appendix A. The vi, ex, and Vim Editors
This appendix summarizes the standard features of vi
in
quick-reference format. Commands entered at the colon prompt (known as ex
commands because they date back to the original creation of that editor)
are included, as well as the most popular Vim features.
This appendix presents the following topics:
-
Command-line syntax
-
Review of
vi
operations -
vi
commands -
vi
configuration -
ex
basics -
Alphabetical summary of
ex
commands
Command-Line Syntax
The three most common ways of starting a Vim session are:
vim [options
]file
vim [options
] -cnum file
vim [options
] -c /pattern file
You can open file for editing, optionally at line num or at the first line matching pattern. If no file is specified, the editor opens with an empty buffer.
Command-Line Options
Because vi
and ex
are the same program, they share the same
options. However, some options make sense for only one version of the
program. Brackets indicate optional items.
Command-line options specific to Vim are so marked:
+[
num
]
-
Start editing at line number num, or at the last line of the file if num is omitted.
+/
pattern
-
Start editing at the first line matching pattern.1
+?
pattern
-
Start editing at the last line matching pattern.1
-b
-
Edit the file in binary mode. {Vim}
-c
command
-
Run the given
ex
command upon startup. Only one-c
option is permitted forvi
; Vim accepts up to 10. The older form of this option,+
command
, is still supported. --cmd
command
-
Like
-c
, but execute ...
Get Learning the vi and Vim Editors, 8th 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.