1VIM(1)                      General Commands Manual                     VIM(1)
2
3
4

NAME

6       vim - Vi IMproved, a programmer's text editor
7

SYNOPSIS

9       vim [options] [file ..]
10       vim [options] -
11       vim [options] -t tag
12       vim [options] -q [errorfile]
13
14       ex gex
15       view
16       gvim gview vimx evim eview
17       rvim rview rgvim rgview
18

DESCRIPTION

20       Vim  is a text editor that is upwards compatible to Vi.  It can be used
21       to edit all kinds of plain text.  It is especially useful  for  editing
22       programs.
23
24       There  are a lot of enhancements above Vi: multi level undo, multi win‐
25       dows and buffers, syntax highlighting, command line  editing,  filename
26       completion,   on-line   help,   visual  selection,  etc..   See  ":help
27       vi_diff.txt" for a summary of the differences between Vim and Vi.
28
29       While running Vim a lot of help can be obtained from the  on-line  help
30       system, with the ":help" command.  See the ON-LINE HELP section below.
31
32       Most often Vim is started to edit a single file with the command
33
34            vim file
35
36       More generally Vim is started with:
37
38            vim [options] [filelist]
39
40       If the filelist is missing, the editor will start with an empty buffer.
41       Otherwise exactly one out of the following four may be used  to  choose
42       one or more files to be edited.
43
44       file ..     A  list  of  filenames.   The first one will be the current
45                   file and read into the buffer.  The cursor  will  be  posi‐
46                   tioned on the first line of the buffer.  You can get to the
47                   other files with the ":next" command.  To edit a file  that
48                   starts with a dash, precede the filelist with "--".
49
50       -           The  file  to  edit  is read from stdin.  Commands are read
51                   from stderr, which should be a TTY.
52
53       -t {tag}    The file to edit and the initial cursor position depends on
54                   a  "tag",  a sort of goto label.  {tag} is looked up in the
55                   tags file, the associated file becomes the current file and
56                   the  associated  command  is executed.  Mostly this is used
57                   for C programs, in which case {tag}  could  be  a  function
58                   name.  The effect is that the file containing that function
59                   becomes the current file and the cursor  is  positioned  on
60                   the start of the function.  See ":help tag-commands".
61
62       -q [errorfile]
63                   Start  in  quickFix mode.  The file [errorfile] is read and
64                   the first error is displayed.  If [errorfile]  is  omitted,
65                   the  filename  is obtained from the 'errorfile' option (de‐
66                   faults to "AztecC.Err" for the Amiga, "errors.err" on other
67                   systems).   Further  errors can be jumped to with the ":cn"
68                   command.  See ":help quickfix".
69
70       Vim behaves differently, depending on the name of the command (the exe‐
71       cutable may still be the same file).
72
73       vim       The "normal" way, everything is default.
74
75       ex        Start  in Ex mode.  Go to Normal mode with the ":vi" command.
76                 Can also be done with the "-e" argument.
77
78       view      Start in read-only mode.  You will be protected from  writing
79                 the files.  Can also be done with the "-R" argument.
80
81       gvim gview
82                 The GUI version.  Starts a new window.
83
84       gex       Starts  a  new  gvim window in Ex mode. Can also be done with
85                 the "-e" argument to gvim
86
87       vimx      Starts gvim in "Vi" mode similar to  "vim",  but  with  addi‐
88                 tional features like xterm clipboard support
89
90       evim eview
91                 The GUI version in easy mode.  Starts a new window.  Can also
92                 be done with the "-y" argument.
93
94       rvim rview rgvim rgview
95                 Like the above, but with restrictions.  It will not be possi‐
96                 ble  to  start  shell  commands, or suspend Vim.  Can also be
97                 done with the "-Z" argument.
98

OPTIONS

100       The options may be given in any order, before or after filenames.   Op‐
101       tions without an argument can be combined after a single dash.
102
103       +[num]      For  the  first  file the cursor will be positioned on line
104                   "num".  If "num" is missing, the cursor will be  positioned
105                   on the last line.
106
107       +/{pat}     For  the  first  file  the cursor will be positioned in the
108                   line with  the  first  occurrence  of  {pat}.   See  ":help
109                   search-pattern" for the available search patterns.
110
111       +{command}
112
113       -c {command}
114                   {command}  will  be  executed after the first file has been
115                   read.  {command} is interpreted as an Ex command.   If  the
116                   {command}  contains  spaces  it  must be enclosed in double
117                   quotes (this depends on the shell that is used).   Example:
118                   vim "+set si" main.c
119                   Note: You can use up to 10 "+" or "-c" commands.
120
121       -S {file}   {file}  will be sourced after the first file has been read.
122                   This is equivalent to -c "source  {file}".   {file}  cannot
123                   start with '-'.  If {file} is omitted "Session.vim" is used
124                   (only works when -S is the last argument).
125
126       --cmd {command}
127                   Like using "-c", but the command is  executed  just  before
128                   processing  any  vimrc file.  You can use up to 10 of these
129                   commands, independently from "-c" commands.
130
131       -A          If Vim has been compiled with ARABIC  support  for  editing
132                   right-to-left  oriented  files and Arabic keyboard mapping,
133                   this option starts Vim in Arabic  mode,  i.e.  'arabic'  is
134                   set.  Otherwise an error message is given and Vim aborts.
135
136       -b          Binary  mode.  A few options will be set that makes it pos‐
137                   sible to edit a binary or executable file.
138
139       -C          Compatible.  Set the 'compatible' option.  This  will  make
140                   Vim  behave  mostly  like Vi, even though a .vimrc file ex‐
141                   ists.
142
143       -d          Start in diff mode.  There should between two to eight file
144                   name  arguments.  Vim will open all the files and show dif‐
145                   ferences between them.  Works like vimdiff(1).
146
147       -d {device} Open {device} for use as a terminal.  Only  on  the  Amiga.
148                   Example: "-d con:20/30/600/150".
149
150       -D          Debugging.   Go  to debugging mode when executing the first
151                   command from a script.
152
153       -e          Start Vim in Ex mode, just like the executable  was  called
154                   "ex".
155
156       -E          Start Vim in improved Ex mode, just like the executable was
157                   called "exim".
158
159       -f          Foreground.  For the GUI version, Vim will not fork and de‐
160                   tach  from  the shell it was started in.  On the Amiga, Vim
161                   is not restarted to open a new window.  This option  should
162                   be  used  when  Vim is executed by a program that will wait
163                   for the edit session to finish (e.g. mail).  On  the  Amiga
164                   the ":sh" and ":!" commands will not work.
165
166       --nofork    Foreground.  For the GUI version, Vim will not fork and de‐
167                   tach from the shell it was started in.
168
169       -F          If Vim has been compiled with  FKMAP  support  for  editing
170                   right-to-left  oriented  files  and Farsi keyboard mapping,
171                   this option starts Vim in  Farsi  mode,  i.e.  'fkmap'  and
172                   'rightleft'  are  set.  Otherwise an error message is given
173                   and Vim aborts.
174
175       -g          If Vim has been compiled with GUI support, this option  en‐
176                   ables the GUI.  If no GUI support was compiled in, an error
177                   message is given and Vim aborts.
178
179       -h          Give a bit of help about the command line arguments and op‐
180                   tions.  After this Vim exits.
181
182       -H          If Vim has been compiled with RIGHTLEFT support for editing
183                   right-to-left oriented files and Hebrew  keyboard  mapping,
184                   this  option  starts  Vim  in Hebrew mode, i.e. 'hkmap' and
185                   'rightleft' are set.  Otherwise an error message  is  given
186                   and Vim aborts.
187
188       -i {viminfo}
189                   Specifies  the  filename to use when reading or writing the
190                   viminfo file, instead of the  default  "~/.viminfo".   This
191                   can  also  be used to skip the use of the .viminfo file, by
192                   giving the name "NONE".
193
194       -L          Same as -r.
195
196       -l          Lisp mode.  Sets the 'lisp' and 'showmatch' options on.
197
198       -m          Modifying files is disabled.  Resets  the  'write'  option.
199                   You  can still modify the buffer, but writing a file is not
200                   possible.
201
202       -M          Modifications not allowed.  The  'modifiable'  and  'write'
203                   options  will be unset, so that changes are not allowed and
204                   files can not be written.  Note that these options  can  be
205                   set to enable making modifications.
206
207       -N          No-compatible  mode.  Resets the 'compatible' option.  This
208                   will make Vim behave a bit better, but less Vi  compatible,
209                   even though a .vimrc file does not exist.
210
211       -n          No  swap file will be used.  Recovery after a crash will be
212                   impossible.  Handy if you want to edit a  file  on  a  very
213                   slow  medium  (e.g.  floppy).   Can also be done with ":set
214                   uc=0".  Can be undone with ":set uc=200".
215
216       -nb         Become an editor server for NetBeans.  See the docs for de‐
217                   tails.
218
219       -o[N]       Open N windows stacked.  When N is omitted, open one window
220                   for each file.
221
222       -O[N]       Open N windows side by side.  When N is omitted,  open  one
223                   window for each file.
224
225       -p[N]       Open N tab pages.  When N is omitted, open one tab page for
226                   each file.
227
228       -R          Read-only mode.  The 'readonly' option will  be  set.   You
229                   can still edit the buffer, but will be prevented from acci‐
230                   dentally overwriting a file.  If you do want to overwrite a
231                   file,  add  an  exclamation  mark  to the Ex command, as in
232                   ":w!".  The -R option  also  implies  the  -n  option  (see
233                   above).   The  'readonly'  option  can  be reset with ":set
234                   noro".  See ":help 'readonly'".
235
236       -r          List swap files, with information about using them for  re‐
237                   covery.
238
239       -r {file}   Recovery  mode.  The swap file is used to recover a crashed
240                   editing session.  The swap file is a  file  with  the  same
241                   filename as the text file with ".swp" appended.  See ":help
242                   recovery".
243
244       -s          Silent mode.  Only when started as "Ex" or  when  the  "-e"
245                   option was given before the "-s" option.
246
247       -s {scriptin}
248                   The  script file {scriptin} is read.  The characters in the
249                   file are interpreted as if you had typed  them.   The  same
250                   can be done with the command ":source! {scriptin}".  If the
251                   end of the file is reached before the editor exits, further
252                   characters are read from the keyboard.
253
254       -T {terminal}
255                   Tells Vim the name of the terminal you are using.  Only re‐
256                   quired when the automatic way doesn't work.   Should  be  a
257                   terminal  known  to Vim (builtin) or defined in the termcap
258                   or terminfo file.
259
260       -u {vimrc}  Use the commands in the file {vimrc}  for  initializations.
261                   All  the  other  initializations  are skipped.  Use this to
262                   edit a special kind of files.  It can also be used to  skip
263                   all  initializations by giving the name "NONE".  See ":help
264                   initialization" within vim for more details.
265
266       -U {gvimrc} Use the commands in the file {gvimrc} for  GUI  initializa‐
267                   tions.   All the other GUI initializations are skipped.  It
268                   can also be used to skip all GUI initializations by  giving
269                   the  name "NONE".  See ":help gui-init" within vim for more
270                   details.
271
272       -V[N]       Verbose.  Give messages about which files are  sourced  and
273                   for  reading and writing a viminfo file.  The optional num‐
274                   ber N is the value for 'verbose'.  Default is 10.
275
276       -v          Start Vim in Vi mode, just like the executable  was  called
277                   "vi".   This  only has effect when the executable is called
278                   "ex".
279
280       -w {scriptout}
281                   All the characters that you type are recorded in  the  file
282                   {scriptout},  until  you  exit  Vim.  This is useful if you
283                   want to create a script file to be used with  "vim  -s"  or
284                   ":source!".  If the {scriptout} file exists, characters are
285                   appended.
286
287       -W {scriptout}
288                   Like -w, but an existing file is overwritten.
289
290       -x          Use encryption when writing files.  Will prompt for a crypt
291                   key.
292
293       -X          Don't  connect to the X server.  Shortens startup time in a
294                   terminal, but the window title and clipboard  will  not  be
295                   used.
296
297       -y          Start Vim in easy mode, just like the executable was called
298                   "evim" or "eview".  Makes Vim behave like a  click-and-type
299                   editor.
300
301       -Z          Restricted  mode.   Works  like  the executable starts with
302                   "r".
303
304       --          Denotes the end of the options.  Arguments after this  will
305                   be  handled  as  a  file  name.  This can be used to edit a
306                   filename that starts with a '-'.
307
308       --clean     Do not use  any  personal  configuration  (vimrc,  plugins,
309                   etc.).   Useful to see if a problem reproduces with a clean
310                   Vim setup.
311
312       --echo-wid  GTK GUI only: Echo the Window ID on stdout.
313
314       --help      Give a help message and exit, just like "-h".
315
316       --literal   Take file name arguments literally,  do  not  expand  wild‐
317                   cards.   This has no effect on Unix where the shell expands
318                   wildcards.
319
320       --noplugin  Skip loading plugins.  Implied by -u NONE.
321
322       --remote    Connect to a Vim server and make it edit the files given in
323                   the rest of the arguments.  If no server is found a warning
324                   is given and the files are edited in the current Vim.
325
326       --remote-expr {expr}
327                   Connect to a Vim server, evaluate {expr} in  it  and  print
328                   the result on stdout.
329
330       --remote-send {keys}
331                   Connect to a Vim server and send {keys} to it.
332
333       --remote-silent
334                   As  --remote,  but  without  the  warning when no server is
335                   found.
336
337       --remote-wait
338                   As --remote, but Vim does not exit  until  the  files  have
339                   been edited.
340
341       --remote-wait-silent
342                   As --remote-wait, but without the warning when no server is
343                   found.
344
345       --remote-tab[-wait][-silent]
346                   As --remote but use tab page per file
347
348       --role      Set a unique role to identify the main window
349
350       --serverlist
351                   List the names of all Vim servers that can be found.
352
353       --servername {name}
354                   Use {name} as the server name.  Used for the  current  Vim,
355                   unless used with a --remote argument, then it's the name of
356                   the server to connect to.
357
358       --socketid {id}
359                   GTK GUI only: Use the GtkPlug mechanism to run gvim in  an‐
360                   other window.
361
362       --startuptime {file}
363                   During startup write timing messages to the file {fname}.
364
365       --version   Print version information and exit.
366

ON-LINE HELP

368       Type  ":help"  in Vim to get started.  Type ":help subject" to get help
369       on a specific subject.  For example: ":help ZZ" to  get  help  for  the
370       "ZZ"  command.   Use <Tab> and CTRL-D to complete subjects (":help cmd‐
371       line-completion").  Tags are present to jump from one place to  another
372       (sort of hypertext links, see ":help").  All documentation files can be
373       viewed in this way, for example ":help syntax.txt".
374

FILES

376       /usr/share/vim/vim82/doc/*.txt
377                      The Vim documentation files.  Use ":help  doc-file-list"
378                      to get the complete list.
379
380       /usr/share/vim/vim82/doc/tags
381                      The  tags file used for finding information in the docu‐
382                      mentation files.
383
384       /usr/share/vim/vim82/syntax/syntax.vim
385                      System wide syntax initializations.
386
387       /usr/share/vim/vim82/syntax/*.vim
388                      Syntax files for various languages.
389
390       /usr/share/vim/vimrc
391                      System wide Vim initializations.
392
393       ~/.vimrc       Your personal Vim initializations.
394
395       /usr/share/vim/gvimrc
396                      System wide gvim initializations.
397
398       ~/.gvimrc      Your personal gvim initializations.
399
400       /usr/share/vim/vim82/optwin.vim
401                      Script used for the ":options" command, a  nice  way  to
402                      view and set options.
403
404       /usr/share/vim/vim82/menu.vim
405                      System wide menu initializations for gvim.
406
407       /usr/share/vim/vim82/bugreport.vim
408                      Script to generate a bug report.  See ":help bugs".
409
410       /usr/share/vim/vim82/filetype.vim
411                      Script  to  detect  the type of a file by its name.  See
412                      ":help 'filetype'".
413
414       /usr/share/vim/vim82/scripts.vim
415                      Script to detect the type of a  file  by  its  contents.
416                      See ":help 'filetype'".
417
418       /usr/share/vim/vim82/print/*.ps
419                      Files used for PostScript printing.
420
421       For recent info read the VIM home page:
422       <URL:http://www.vim.org/>
423

SEE ALSO

425       vimtutor(1)
426

AUTHOR

428       Most of Vim was made by Bram Moolenaar, with a lot of help from others.
429       See ":help credits" in Vim.
430       Vim is based on Stevie, worked on by: Tim Thompson,  Tony  Andrews  and
431       G.R. (Fred) Walter.  Although hardly any of the original code remains.
432

BUGS

434       Probably.  See ":help todo" for a list of known problems.
435
436       Note  that a number of things that may be regarded as bugs by some, are
437       in fact caused by a too-faithful reproduction of Vi's  behaviour.   And
438       if  you  think  other things are bugs "because Vi does it differently",
439       you should take a closer look at the vi_diff.txt file  (or  type  :help
440       vi_diff.txt  when  in  Vim).   Also have a look at the 'compatible' and
441       'cpoptions' options.
442
443
444
445                                  2006 Apr 11                           VIM(1)
Impressum