*starting.txt* For Vim version 7.1. Last change: 2007 Aug 14
VIM REFERENCE MANUAL by Bram Moolenaar
Starting Vim *starting*
1. Vim arguments |vim-arguments|
2. Vim on the Amiga |starting-amiga|
3. Running eVim |evim-keys|
4. Initialization |initialization|
5. $VIM and $VIMRUNTIME |$VIM|
6. Suspending |suspend|
7. Saving settings |save-settings|
8. Views and Sessions |views-sessions|
9. The viminfo file |viminfo-file|
==============================================================================
1. Vim arguments *vim-arguments*
Most often, Vim is started to edit a single file with the command
vim filename *-vim*
More generally, Vim is started with:
vim [option | filename] ..
Option arguments and file name arguments can be mixed, and any number of them
can be given. However, watch out for options that take an argument.
For compatibility with various Vi versions, see |cmdline-arguments|.
Exactly one out of the following five items may be used to choose how to
start editing:
*-file* *---*
filename One or more file names. The first one will be the current
file and read into the buffer. The cursor will be positioned
on the first line of the buffer.
To avoid a file name starting with a '-' being interpreted as
an option, precede the arglist with "--", e.g.: >
vim -- -filename
< All arguments after the "--" will be interpreted as file names,
no other options or "+command" argument can follow.
*--*
- This argument can mean two things, depending on whether Ex
mode is to be used.
Starting in Normal mode: >
vim -
ex -v -
< Start editing a new buffer, which is filled with text
that is read from stdin. The commands that would normally be
read from stdin will now be read from stderr. Example: >
find . -name "*.c" -print | vim -
< The buffer will be marked modified, because it contains text
that needs to be saved. Except when in readonly mode, then
the buffer is not marked modified. Example: >
ls | view -
<
Starting in Ex mode: >
ex -
vim -e -
exim -
vim -E
< Start editing in silent mode. See |-s-ex|.
*-t* *-tag*
-t {tag} A tag. "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" often is 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
|tags|).
*-q* *-qf*
-q [errorfile] QuickFix mode. The file with the name [errorfile] is read
and the first error is displayed. See |quickfix|.
If [errorfile] is not given, the 'errorfile' option is used
for the file name. See 'errorfile' for the default value.
{not in Vi}
(nothing) Without one of the four items above, Vim will start editing a
new buffer. It's empty and doesn't have a file name.
The startup mode can be changed by using another name instead of "vim", which
is equal to giving options:
ex vim -e Start in Ex mode (see |Ex-mode|). *ex*
exim vim -E Start in improved Ex mode (see |Ex-mode|). *exim*
(normally not installed)
view vim -R Start in read-only mode (see |-R|). *view*
gvim vim -g Start the GUI (see |gui|). *gvim*
gex vim -eg Start the GUI in Ex mode. *gex*
gview vim -Rg Start the GUI in read-only mode. *gview*
rvim vim -Z Like "vim", but in restricted mode (see |-Z|) *rvim*
rview vim -RZ Like "view", but in restricted mode. *rview*
rgvim vim -gZ Like "gvim", but in restricted mode. *rgvim*
rgview vim -RgZ Like "gview", but in restricted mode. *rgview*
evim vim -y Easy Vim: set 'insertmode' (see |-y|) *evim*
eview vim -yR Like "evim" in read-only mode *eview*
vimdiff vim -d Start in diff mode |diff-mode|
gvimdiff vim -gd Start in diff mode |diff-mode|
Additional characters may follow, they are ignored. For example, you can have
"gvim-5" to start the GUI. You must have an executable by that name then, of
course.
On Unix, you would normally have one executable called Vim, and links from the
different startup-names to that executable. If your system does not support
links and you do not want to have several copies of the executable, you could
use an alias instead. For example: >
alias view vim -R
alias gvim vim -g
<
*startup-options*
The option arguments may be given in any order. Single-letter options can be
combined after one dash. There can be no option arguments after the "--"
argument.
On VMS all option arguments are assumed to be lowercase, unless preceded with
a slash. Thus "-R" means recovery and "-/R" readonly.
--help *-h* *--help*
-h Give usage (help) message and exit. {not in Vi}
See |info-message| about capturing the text.
*--version*
--version Print version information and exit. Same output as fo