Linux "vim" 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 Excommand. If the {command} contains spaces it must be enclosed in double quotes (this depends onthe shell that is used). Example: Vim "+set si" main.cNote: You can use up to 10 "+" or "-c" commands.
vim -c ...
--cmd
Like using "-c", but the command is executed just before processing any vimrc file. You can useup to 10 of these commands, independently from "-c" commands.
vim --cmd ...
-d
{device} Open {device} for use as a terminal. Only on the Amiga. Example: "-d con:20/30/600/150".
vim -d ...
-D
Debugging. Go to debugging mode when executing the first command from a script.
vim -D ...
-e
Start Vim in Ex mode, just like the executable was called "ex".
vim -e ...
-E
Start Vim in improved Ex mode, just like the executable was called "exim".
vim -E ...
--nofork
Foreground. For the GUI version, Vim will not fork and detach from the shell it was started in.
vim --nofork ...
-h
Give a bit of help about the command line arguments and options. After this Vim exits.
vim -h ...
-i
When using the viminfo file is enabled, this option sets the filename to use, instead of thedefault "~/.viminfo". This can also be used to skip the use of the .viminfo file, by giving thename "NONE".
vim -i ...
-l
Lisp mode. Sets the 'lisp' and 'showmatch' options on.
vim -l ...
-nb
Become an editor server for NetBeans. See the docs for details.
vim -nb ...
-o[N]
Open N windows stacked. When N is omitted, open one window for each file.
vim -o[N] ...
-O[N]
Open N windows side by side. When N is omitted, open one window for each file.
vim -O[N] ...
-p[N]
Open N tab pages. When N is omitted, open one tab page for each file.
vim -p[N] ...
-r
with information about using them for recovery.
vim -r ...
-s
Silent mode. Only when started as "Ex" or when the "-e" option was given before the "-s" option.
vim -s ...
-T
Tells Vim the name of the terminal you are using. Only required when the automatic way doesn'twork. Should be a terminal known to Vim (builtin) or defined in the termcap or terminfo file.
vim -T ...
-w
All the characters that you type are recorded in the file {scriptout}, until you exit Vim. Thisis useful if you want to create a script file to be used with "vim -s" or ":source!". If the{scriptout} file exists, characters are appended.
vim -w ...
-W
Like -w, but an existing file is overwritten.
vim -W ...
-x
Use encryption when writing files. Will prompt for a crypt key.
vim -x ...
-Z
Restricted mode. Works like the executable starts with "r".
vim -Z ...
--echo-wid
GTK GUI only: Echo the Window ID on stdout.
vim --echo-wid ...
--help
Give a help message and exit, just like "-h".
vim --help ...
--noplugin
Skip loading plugins. Implied by -u NONE.
vim --noplugin ...
--remote-expr
Connect to a Vim server, evaluate {expr} in it and print the result on stdout.
vim --remote-expr ...
--remote-send
Connect to a Vim server and send {keys} to it.
vim --remote-send ...
--remote-silent
As --remote, but without the warning when no server is found.
vim --remote-silent ...
--remote-wait
As --remote, but Vim does not exit until the files have been edited.
vim --remote-wait ...
--remote-wait-silent
As --remote-wait, but without the warning when no server is found.
vim --remote-wait-silent ...
--serverlist
List the names of all Vim servers that can be found.
vim --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 the server to connect to.
vim --servername ...
--socketid
GTK GUI only: Use the GtkPlug mechanism to run gvim in another window.
vim --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 for the "ZZ" command. Use <Tab> and CTRL-D to complete subjects (":help cmdline-com‐pletion"). Tags are present to jump from one place to another (sort of hypertext links, see ":help"). Alldocumentation files can be viewed in this way, for example ":help syntax.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/>
vim --version ...