vim.1 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. .TH VIM 1 "2021 Jun 13"
  2. .SH NAME
  3. vim \- Vi IMproved, a programmer's text editor
  4. .SH SYNOPSIS
  5. .br
  6. .B vim
  7. [options] [file ..]
  8. .br
  9. .B vim
  10. [options] \-
  11. .br
  12. .B vim
  13. [options] \-t tag
  14. .br
  15. .B vim
  16. [options] \-q [errorfile]
  17. .PP
  18. .br
  19. .B ex
  20. .br
  21. .B view
  22. .br
  23. .B gvim
  24. .B gview
  25. .B evim
  26. .B eview
  27. .br
  28. .B rvim
  29. .B rview
  30. .B rgvim
  31. .B rgview
  32. .SH DESCRIPTION
  33. .B Vim
  34. is a text editor that is upwards compatible to Vi.
  35. It can be used to edit all kinds of plain text.
  36. It is especially useful for editing programs.
  37. .PP
  38. There are a lot of enhancements above Vi: multi level undo,
  39. multi windows and buffers, syntax highlighting, command line
  40. editing, filename completion, on-line help, visual selection, etc..
  41. See ":help vi_diff.txt" for a summary of the differences between
  42. .B Vim
  43. and Vi.
  44. .PP
  45. While running
  46. .B Vim
  47. a lot of help can be obtained from the on-line help system, with the ":help"
  48. command.
  49. See the ON-LINE HELP section below.
  50. .PP
  51. Most often
  52. .B Vim
  53. is started to edit a single file with the command
  54. .PP
  55. vim file
  56. .PP
  57. More generally
  58. .B Vim
  59. is started with:
  60. .PP
  61. vim [options] [filelist]
  62. .PP
  63. If the filelist is missing, the editor will start with an empty buffer.
  64. Otherwise exactly one out of the following four may be used to choose one or
  65. more files to be edited.
  66. .TP 12
  67. file ..
  68. A list of filenames.
  69. The first one will be the current file and read into the buffer.
  70. The cursor will be positioned on the first line of the buffer.
  71. You can get to the other files with the ":next" command.
  72. To edit a file that starts with a dash, precede the filelist with "\-\-".
  73. .TP
  74. \-
  75. The file to edit is read from stdin. Commands are read from stderr, which
  76. should be a tty.
  77. .TP
  78. \-t {tag}
  79. The file to edit and the initial cursor position depends on a "tag", a sort
  80. of goto label.
  81. {tag} is looked up in the tags file, the associated file becomes the current
  82. file and the associated command is executed.
  83. Mostly this is used for C programs, in which case {tag} could be a function
  84. name.
  85. The effect is that the file containing that function becomes the current file
  86. and the cursor is positioned on the start of the function.
  87. See ":help tag\-commands".
  88. .TP
  89. \-q [errorfile]
  90. Start in quickFix mode.
  91. The file [errorfile] is read and the first error is displayed.
  92. If [errorfile] is omitted, the filename is obtained from the 'errorfile'
  93. option (defaults to "AztecC.Err" for the Amiga, "errors.err" on other
  94. systems).
  95. Further errors can be jumped to with the ":cn" command.
  96. See ":help quickfix".
  97. .PP
  98. .B Vim
  99. behaves differently, depending on the name of the command (the executable may
  100. still be the same file).
  101. .TP 10
  102. vim
  103. The "normal" way, everything is default.
  104. .TP
  105. ex
  106. Start in Ex mode.
  107. Go to Normal mode with the ":vi" command.
  108. Can also be done with the "\-e" argument.
  109. .TP
  110. view
  111. Start in read-only mode. You will be protected from writing the files.
  112. Can also be done with the "\-R" argument.
  113. .TP
  114. gvim gview
  115. The GUI version.
  116. Starts a new window.
  117. Can also be done with the "\-g" argument.
  118. .TP
  119. evim eview
  120. The GUI version in easy mode.
  121. Starts a new window.
  122. Can also be done with the "\-y" argument.
  123. .TP
  124. rvim rview rgvim rgview
  125. Like the above, but with restrictions. It will not be possible to start shell
  126. commands, or suspend
  127. .B Vim.
  128. Can also be done with the "\-Z" argument.
  129. .SH OPTIONS
  130. The options may be given in any order, before or after filenames.
  131. Options without an argument can be combined after a single dash.
  132. .TP 12
  133. +[num]
  134. For the first file the cursor will be positioned on line "num".
  135. If "num" is missing, the cursor will be positioned on the last line.
  136. .TP
  137. +/{pat}
  138. For the first file the cursor will be positioned in the line with the
  139. first occurrence of {pat}.
  140. See ":help search\-pattern" for the available search patterns.
  141. .TP
  142. +{command}
  143. .TP
  144. \-c {command}
  145. {command} will be executed after the first file has been read.
  146. {command} is interpreted as an Ex command.
  147. If the {command} contains spaces it must be enclosed in double quotes (this
  148. depends on the shell that is used).
  149. Example: vim "+set si" main.c
  150. .br
  151. Note: You can use up to 10 "+" or "\-c" commands.
  152. .TP
  153. \-S {file}
  154. {file} will be sourced after the first file has been read.
  155. This is equivalent to \-c "source {file}".
  156. {file} cannot start with '\-'.
  157. If {file} is omitted "Session.vim" is used (only works when \-S is the last
  158. argument).
  159. .TP
  160. \-\-cmd {command}
  161. Like using "\-c", but the command is executed just before
  162. processing any vimrc file.
  163. You can use up to 10 of these commands, independently from "\-c" commands.
  164. .TP
  165. \-A
  166. If
  167. .B Vim
  168. has been compiled with ARABIC support for editing right-to-left
  169. oriented files and Arabic keyboard mapping, this option starts
  170. .B Vim
  171. in Arabic mode, i.e. 'arabic' is set. Otherwise an error
  172. message is given and
  173. .B Vim
  174. aborts.
  175. .TP
  176. \-b
  177. Binary mode.
  178. A few options will be set that makes it possible to edit a binary or
  179. executable file.
  180. .TP
  181. \-C
  182. Compatible. Set the 'compatible' option.
  183. This will make
  184. .B Vim
  185. behave mostly like Vi, even though a .vimrc file exists.
  186. .TP
  187. \-d
  188. Start in diff mode.
  189. There should between two to eight file name arguments.
  190. .B Vim
  191. will open all the files and show differences between them.
  192. Works like vimdiff(1).
  193. .TP
  194. \-d {device}
  195. Open {device} for use as a terminal.
  196. Only on the Amiga.
  197. Example:
  198. "\-d con:20/30/600/150".
  199. .TP
  200. \-D
  201. Debugging. Go to debugging mode when executing the first command from a
  202. script.
  203. .TP
  204. \-e
  205. Start
  206. .B Vim
  207. in Ex mode, just like the executable was called "ex".
  208. .TP
  209. \-E
  210. Start
  211. .B Vim
  212. in improved Ex mode, just like the executable was called "exim".
  213. .TP
  214. \-f
  215. Foreground. For the GUI version,
  216. .B Vim
  217. will not fork and detach from the shell it was started in.
  218. On the Amiga,
  219. .B Vim
  220. is not restarted to open a new window.
  221. This option should be used when
  222. .B Vim
  223. is executed by a program that will wait for the edit
  224. session to finish (e.g. mail).
  225. On the Amiga the ":sh" and ":!" commands will not work.
  226. .TP
  227. \-\-nofork
  228. Foreground. For the GUI version,
  229. .B Vim
  230. will not fork and detach from the shell it was started in.
  231. .TP
  232. \-F
  233. If
  234. .B Vim
  235. has been compiled with FKMAP support for editing right-to-left
  236. oriented files and Farsi keyboard mapping, this option starts
  237. .B Vim
  238. in Farsi mode, i.e. 'fkmap' and 'rightleft' are set.
  239. Otherwise an error message is given and
  240. .B Vim
  241. aborts.
  242. .TP
  243. \-g
  244. If
  245. .B Vim
  246. has been compiled with GUI support, this option enables the GUI.
  247. If no GUI support was compiled in, an error message is given and
  248. .B Vim
  249. aborts.
  250. .TP
  251. \-h
  252. Give a bit of help about the command line arguments and options.
  253. After this
  254. .B Vim
  255. exits.
  256. .TP
  257. \-H
  258. If
  259. .B Vim
  260. has been compiled with RIGHTLEFT support for editing right-to-left
  261. oriented files and Hebrew keyboard mapping, this option starts
  262. .B Vim
  263. in Hebrew mode, i.e. 'hkmap' and 'rightleft' are set.
  264. Otherwise an error message is given and
  265. .B Vim
  266. aborts.
  267. .TP
  268. \-i {viminfo}
  269. Specifies the filename to use when reading or writing the viminfo file,
  270. instead of the default "~/.viminfo".
  271. This can also be used to skip the use of the .viminfo file, by giving the name
  272. "NONE".
  273. .TP
  274. \-L
  275. Same as \-r.
  276. .TP
  277. \-l
  278. Lisp mode.
  279. Sets the 'lisp' and 'showmatch' options on.
  280. .TP
  281. \-m
  282. Modifying files is disabled.
  283. Resets the 'write' option.
  284. You can still modify the buffer, but writing a file is not possible.
  285. .TP
  286. \-M
  287. Modifications not allowed. The 'modifiable' and 'write' options will be unset,
  288. so that changes are not allowed and files can not be written. Note that these
  289. options can be set to enable making modifications.
  290. .TP
  291. \-N
  292. No-compatible mode. Resets the 'compatible' option.
  293. This will make
  294. .B Vim
  295. behave a bit better, but less Vi compatible, even though a .vimrc file does
  296. not exist.
  297. .TP
  298. \-n
  299. No swap file will be used.
  300. Recovery after a crash will be impossible.
  301. Handy if you want to edit a file on a very slow medium (e.g. floppy).
  302. Can also be done with ":set uc=0".
  303. Can be undone with ":set uc=200".
  304. .TP
  305. \-nb
  306. Become an editor server for NetBeans. See the docs for details.
  307. .TP
  308. \-o[N]
  309. Open N windows stacked.
  310. When N is omitted, open one window for each file.
  311. .TP
  312. \-O[N]
  313. Open N windows side by side.
  314. When N is omitted, open one window for each file.
  315. .TP
  316. \-p[N]
  317. Open N tab pages.
  318. When N is omitted, open one tab page for each file.
  319. .TP
  320. \-R
  321. Read-only mode.
  322. The 'readonly' option will be set.
  323. You can still edit the buffer, but will be prevented from accidentally
  324. overwriting a file.
  325. If you do want to overwrite a file, add an exclamation mark to the Ex command,
  326. as in ":w!".
  327. The \-R option also implies the \-n option (see above).
  328. The 'readonly' option can be reset with ":set noro".
  329. See ":help 'readonly'".
  330. .TP
  331. \-r
  332. List swap files, with information about using them for recovery.
  333. .TP
  334. \-r {file}
  335. Recovery mode.
  336. The swap file is used to recover a crashed editing session.
  337. The swap file is a file with the same filename as the text file with ".swp"
  338. appended.
  339. See ":help recovery".
  340. .TP
  341. \-s
  342. Silent mode. Only when started as "Ex" or when the "\-e" option was given
  343. before the "\-s" option.
  344. .TP
  345. \-s {scriptin}
  346. The script file {scriptin} is read.
  347. The characters in the file are interpreted as if you had typed them.
  348. The same can be done with the command ":source! {scriptin}".
  349. If the end of the file is reached before the editor exits, further characters
  350. are read from the keyboard.
  351. .TP
  352. \-T {terminal}
  353. Tells
  354. .B Vim
  355. the name of the terminal you are using.
  356. Only required when the automatic way doesn't work.
  357. Should be a terminal known to
  358. .B Vim
  359. (builtin) or defined in the termcap or terminfo file.
  360. .TP
  361. \-u {vimrc}
  362. Use the commands in the file {vimrc} for initializations.
  363. All the other initializations are skipped.
  364. Use this to edit a special kind of files.
  365. It can also be used to skip all initializations by giving the name "NONE".
  366. See ":help initialization" within vim for more details.
  367. .TP
  368. \-U {gvimrc}
  369. Use the commands in the file {gvimrc} for GUI initializations.
  370. All the other GUI initializations are skipped.
  371. It can also be used to skip all GUI initializations by giving the name "NONE".
  372. See ":help gui\-init" within vim for more details.
  373. .TP
  374. \-V[N]
  375. Verbose. Give messages about which files are sourced and for reading and
  376. writing a viminfo file. The optional number N is the value for 'verbose'.
  377. Default is 10.
  378. .TP
  379. \-v
  380. Start
  381. .B Vim
  382. in Vi mode, just like the executable was called "vi". This only has effect
  383. when the executable is called "ex".
  384. .TP
  385. \-w {scriptout}
  386. All the characters that you type are recorded in the file
  387. {scriptout}, until you exit
  388. .B Vim.
  389. This is useful if you want to create a script file to be used with "vim \-s" or
  390. ":source!".
  391. If the {scriptout} file exists, characters are appended.
  392. .TP
  393. \-W {scriptout}
  394. Like \-w, but an existing file is overwritten.
  395. .TP
  396. \-x
  397. Use encryption when writing files. Will prompt for a crypt key.
  398. .TP
  399. \-X
  400. Don't connect to the X server. Shortens startup time in a terminal, but the
  401. window title and clipboard will not be used.
  402. .TP
  403. \-y
  404. Start
  405. .B Vim
  406. in easy mode, just like the executable was called "evim" or "eview".
  407. Makes
  408. .B Vim
  409. behave like a click-and-type editor.
  410. .TP
  411. \-Z
  412. Restricted mode. Works like the executable starts with "r".
  413. .TP
  414. \-\-
  415. Denotes the end of the options.
  416. Arguments after this will be handled as a file name.
  417. This can be used to edit a filename that starts with a '\-'.
  418. .TP
  419. \-\-clean
  420. Do not use any personal configuration (vimrc, plugins, etc.). Useful to see if
  421. a problem reproduces with a clean Vim setup.
  422. .TP
  423. \-\-echo\-wid
  424. GTK GUI only: Echo the Window ID on stdout.
  425. .TP
  426. \-\-help
  427. Give a help message and exit, just like "\-h".
  428. .TP
  429. \-\-literal
  430. Take file name arguments literally, do not expand wildcards. This has no
  431. effect on Unix where the shell expands wildcards.
  432. .TP
  433. \-\-noplugin
  434. Skip loading plugins. Implied by \-u NONE.
  435. .TP
  436. \-\-remote
  437. Connect to a Vim server and make it edit the files given in the rest of the
  438. arguments. If no server is found a warning is given and the files are edited
  439. in the current Vim.
  440. .TP
  441. \-\-remote\-expr {expr}
  442. Connect to a Vim server, evaluate {expr} in it and print the result on stdout.
  443. .TP
  444. \-\-remote\-send {keys}
  445. Connect to a Vim server and send {keys} to it.
  446. .TP
  447. \-\-remote\-silent
  448. As \-\-remote, but without the warning when no server is found.
  449. .TP
  450. \-\-remote\-wait
  451. As \-\-remote, but Vim does not exit until the files have been edited.
  452. .TP
  453. \-\-remote\-wait\-silent
  454. As \-\-remote\-wait, but without the warning when no server is found.
  455. .TP
  456. \-\-serverlist
  457. List the names of all Vim servers that can be found.
  458. .TP
  459. \-\-servername {name}
  460. Use {name} as the server name. Used for the current Vim, unless used with a
  461. \-\-remote argument, then it's the name of the server to connect to.
  462. .TP
  463. \-\-socketid {id}
  464. GTK GUI only: Use the GtkPlug mechanism to run gvim in another window.
  465. .TP
  466. \-\-startuptime {file}
  467. During startup write timing messages to the file {fname}.
  468. .TP
  469. \-\-version
  470. Print version information and exit.
  471. .SH ON-LINE HELP
  472. Type ":help" in
  473. .B Vim
  474. to get started.
  475. Type ":help subject" to get help on a specific subject.
  476. For example: ":help ZZ" to get help for the "ZZ" command.
  477. Use <Tab> and CTRL-D to complete subjects (":help cmdline\-completion").
  478. Tags are present to jump from one place to another (sort of hypertext links,
  479. see ":help").
  480. All documentation files can be viewed in this way, for example
  481. ":help syntax.txt".
  482. .SH FILES
  483. .TP 15
  484. /usr/local/lib/vim/doc/*.txt
  485. The
  486. .B Vim
  487. documentation files.
  488. Use ":help doc\-file\-list" to get the complete list.
  489. .TP
  490. /usr/local/lib/vim/doc/tags
  491. The tags file used for finding information in the documentation files.
  492. .TP
  493. /usr/local/lib/vim/syntax/syntax.vim
  494. System wide syntax initializations.
  495. .TP
  496. /usr/local/lib/vim/syntax/*.vim
  497. Syntax files for various languages.
  498. .TP
  499. /usr/local/lib/vim/vimrc
  500. System wide
  501. .B Vim
  502. initializations.
  503. .TP
  504. ~/.vimrc
  505. Your personal
  506. .B Vim
  507. initializations.
  508. .TP
  509. /usr/local/lib/vim/gvimrc
  510. System wide gvim initializations.
  511. .TP
  512. ~/.gvimrc
  513. Your personal gvim initializations.
  514. .TP
  515. /usr/local/lib/vim/optwin.vim
  516. Script used for the ":options" command, a nice way to view and set options.
  517. .TP
  518. /usr/local/lib/vim/menu.vim
  519. System wide menu initializations for gvim.
  520. .TP
  521. /usr/local/lib/vim/bugreport.vim
  522. Script to generate a bug report. See ":help bugs".
  523. .TP
  524. /usr/local/lib/vim/filetype.vim
  525. Script to detect the type of a file by its name. See ":help 'filetype'".
  526. .TP
  527. /usr/local/lib/vim/scripts.vim
  528. Script to detect the type of a file by its contents. See ":help 'filetype'".
  529. .TP
  530. /usr/local/lib/vim/print/*.ps
  531. Files used for PostScript printing.
  532. .PP
  533. For recent info read the VIM home page:
  534. .br
  535. <URL:http://www.vim.org/>
  536. .SH SEE ALSO
  537. vimtutor(1)
  538. .SH AUTHOR
  539. Most of
  540. .B Vim
  541. was made by Bram Moolenaar, with a lot of help from others.
  542. See ":help credits" in
  543. .B Vim.
  544. .br
  545. .B Vim
  546. is based on Stevie, worked on by: Tim Thompson,
  547. Tony Andrews and G.R. (Fred) Walter.
  548. Although hardly any of the original code remains.
  549. .SH BUGS
  550. Probably.
  551. See ":help todo" for a list of known problems.
  552. .PP
  553. Note that a number of things that may be regarded as bugs by some, are in fact
  554. caused by a too-faithful reproduction of Vi's behaviour.
  555. And if you think other things are bugs "because Vi does it differently",
  556. you should take a closer look at the vi_diff.txt file (or type :help
  557. vi_diff.txt when in Vim).
  558. Also have a look at the 'compatible' and 'cpoptions' options.