Category

Linux Command


Usage

ex


Manual

Vim is a text editor that is upwards compatible to Vi. It can be used
to edit all kinds of plain text. It is especially useful for editing
programs.

There are a lot of enhancements above Vi: multi level undo, multi win-
dows and buffers, syntax highlighting, command line editing, filename
completion, on-line help, visual selection, etc.. See ":help
vi_diff.txt" for a summary of the differences between Vim and Vi.

While running Vim a lot of help can be obtained from the on-line help
system, with the ":help" command. See the ON-LINE HELP section below.

Most often Vim is started to edit a single file with the command

vim file

More generally Vim is started with:

vim [options] [filelist]

If the filelist is missing, the editor will start with an empty buffer.
Otherwise exactly one out of the following four may be used to choose
one or more files to be edited.

file .. A list of filenames. The first one will be the current
file and read into the buffer. The cursor will be posi-
tioned on the first line of the buffer. You can get to the
other files with the ":next" command. To edit a file that
starts with a dash, precede the filelist with "--".

- The file to edit is read from stdin. Commands are read
from stderr, which should be a TTY.

-t {tag} The file to edit and the initial cursor position depends on
a "tag", a sort of goto label. {tag} is looked up in the
tags file, the associated file becomes the current file and
the associated command is executed. Mostly this is used
for C programs, in which case {tag} could be a function
name. The effect is that the file containing that function
becomes the current file and the cursor is positioned on
the start of the function. See ":help tag-commands".

-q [errorfile]
Start in quickFix mode. The file [errorfile] is read and
the first error is displayed. If [errorfile] is omitted,
the filename is obtained from the ’errorfile’ option
(defaults to "AztecC.Err" for the Amiga, "errors.err" on
other systems). Further errors can be jumped to with the
":cn" command. See ":help quickfix".

Vim behaves differently, depending on the name of the command (the exe-
cutable may still be the same file).

vim The "normal" way, everything is default.

ex Start in Ex mode. Go to Normal mode with the ":vi" command.
Can also be done with the "-e" argument.

view Start in read-only mode. You will be protected from writing
the files. Can also be done with the "-R" argument.

gvim gview
The GUI version. Starts a new window.

gex Starts a new gvim window in Ex mode. Can also be done with
the "-e" argument to gvim

vimx Starts gvim in "Vi" mode similar to "vim", but with addi-
tional features like xterm clipboard support

evim eview
The GUI version in easy mode. Starts a new window. Can also
be done with the "-y" argument.

rvim rview rgvim rgview
Like the above, but with restrictions. It will not be possi-
ble to start shell commands, or suspend Vim. Can also be
done with the "-Z" argument.


Share your experience or ask a question