Linux "ex" Command Line Options and Examples
Vi IMproved, a programmer's text editor

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.


Usage:

vim [options] [file ..]
vim [options] -
vim [options] -t tag
vim [options] -q [errorfile]






Command Line Options:

-c
{command} will be executed after the first file has been read. {command} is interpreted as an Ex command. If the {com‐mand} contains spaces it must be enclosed in double quotes (this depends on the shell that is used). Example: Vim "+setsi" main.cNote: You can use up to 10 "+" or "-c" commands.
ex -c ...
--cmd
Like using "-c", but the command is executed just before processing any vimrc file. You can use up to 10 of these com‐mands, independently from "-c" commands.
ex --cmd ...
-b
Binary mode. A few options will be set that makes it possible to edit a binary or executable file.
ex -b ...
-C
Compatible. Set the 'compatible' option. This will make Vim behave mostly like Vi, even though a .vimrc file exists
ex -C ...
-d
{device} Open {device} for use as a terminal. Only on the Amiga. Example: "-d con:20/30/600/150".
ex -d ...
-D
Debugging. Go to debugging mode when executing the first command from a script.
ex -D ...
-e
Start Vim in Ex mode, just like the executable was called "ex".
ex -e ...
-E
Start Vim in improved Ex mode, just like the executable was called "exim".
ex -E ...
--nofork
Foreground. For the GUI version, Vim will not fork and detach from the shell it was started in.
ex --nofork ...
-h
Give a bit of help about the command line arguments and options. After this Vim exits.
ex -h ...
-i
When using the viminfo file is enabled, this option sets the filename to use, instead of the default "~/.viminfo". Thiscan also be used to skip the use of the .viminfo file, by giving the name "NONE".
ex -i ...
-l
Lisp mode. Sets the 'lisp' and 'showmatch' options on.
ex -l ...
-nb
Become an editor server for NetBeans. See the docs for details.
ex -nb ...
-o[N]
Open N windows stacked. When N is omitted, open one window for each file.
ex -o[N] ...
-O[N]
Open N windows side by side. When N is omitted, open one window for each file.
ex -O[N] ...
-p[N]
Open N tab pages. When N is omitted, open one tab page for each file.
ex -p[N] ...
-r
with information about using them for recovery.
ex -r ...
-s
Silent mode. Only when started as "Ex" or when the "-e" option was given before the "-s" option.
ex -s ...
-T
Tells Vim the name of the terminal you are using. Only required when the automatic way doesn't work. Should be a termi‐nal known to Vim (builtin) or defined in the termcap or terminfo file.
ex -T ...
-v
Start Vim in Vi mode, just like the executable was called "vi". This only has effect when the executable is called "ex".
ex -v ...
-w
All the characters that you type are recorded in the file {scriptout}, until you exit Vim. This is useful if you want tocreate a script file to be used with "vim -s" or ":source!". If the {scriptout} file exists, characters are appended.
ex -w ...
-W
Like -w, but an existing file is overwritten.
ex -W ...
-x
Use encryption when writing files. Will prompt for a crypt key.
ex -x ...
-X
Don't connect to the X server. Shortens startup time in a terminal, but the window title and clipboard will not be used.
ex -X ...
-Z
Restricted mode. Works like the executable starts with "r".
ex -Z ...
--echo-wid
GTK GUI only: Echo the Window ID on stdout.
ex --echo-wid ...
--help
Give a help message and exit, just like "-h".
ex --help ...
--noplugin
Skip loading plugins. Implied by -u NONE.
ex --noplugin ...
--remote-expr
Connect to a Vim server, evaluate {expr} in it and print the result on stdout.
ex --remote-expr ...
--remote-send
Connect to a Vim server and send {keys} to it.
ex --remote-send ...
--remote-silent
As --remote, but without the warning when no server is found.
ex --remote-silent ...
--remote-wait
As --remote, but Vim does not exit until the files have been edited.
ex --remote-wait ...
--remote-wait-silent
As --remote-wait, but without the warning when no server is found.
ex --remote-wait-silent ...
--serverlist
List the names of all Vim servers that can be found.
ex --serverlist ...
--servername
Use {name} as the server name. Used for the current Vim, unless used with a --remote argument, then it's the name of theserver to connect to.
ex --servername ...
--socketid
GTK GUI only: Use the GtkPlug mechanism to run gvim in another window.
ex --socketid ...
--version
ON-LINE HELPType ":help" in Vim to get started. Type ":help subject" to get help on a specific subject. For example: ":help ZZ" to get help forthe "ZZ" command. Use <Tab> and CTRL-D to complete subjects (":help cmdline-completion"). Tags are present to jump from one placeto another (sort of hypertext links, see ":help"). All documentation files can be viewed in this way, for example ":help syn‐tax.txt".FILES/usr/share/vim/vim80/doc/*.txtThe Vim documentation files. Use ":help doc-file-list" to get the complete list./usr/share/vim/vim80/doc/tagsThe tags file used for finding information in the documentation files./usr/share/vim/vim80/syntax/syntax.vimSystem wide syntax initializations./usr/share/vim/vim80/syntax/*.vimSyntax files for various languages./usr/share/vim/vimrcSystem wide Vim initializations.~/.vimrc Your personal Vim initializations./usr/share/vim/gvimrcSystem wide gvim initializations.~/.gvimrc Your personal gvim initializations./usr/share/vim/vim80/optwin.vimScript used for the ":options" command, a nice way to view and set options./usr/share/vim/vim80/menu.vimSystem wide menu initializations for gvim./usr/share/vim/vim80/bugreport.vimScript to generate a bug report. See ":help bugs"./usr/share/vim/vim80/filetype.vimScript to detect the type of a file by its name. See ":help 'filetype'"./usr/share/vim/vim80/scripts.vimScript to detect the type of a file by its contents. See ":help 'filetype'"./usr/share/vim/vim80/print/*.psFiles used for PostScript printing.For recent info read the VIM home page:<URL:http://www.vim.org/>
ex --version ...