1*vi_diff.txt* For Vim version 8.1. Last change: 2019 May 13 2 3 4 VIM REFERENCE MANUAL by Bram Moolenaar 5 6 7Differences between Vim and Vi *vi-differences* 8 9This file lists the differences between Vim and Vi/Ex and gives an overview of 10what is in Vim that is not in Vi. 11 12Vim is mostly POSIX 1003.2-1 compliant. The only command known to be missing 13is ":open". There are probably a lot of small differences (either because Vim 14is missing something or because Posix is beside the mark). 15 161. Simulated command |simulated-command| 172. Missing options |missing-options| 183. Limits |limits| 194. The most interesting additions |vim-additions| 205. Other vim features |other-features| 216. Supported Vi features |vi-features| 227. Command-line arguments |cmdline-arguments| 238. POSIX compliance |posix-compliance| 24 25============================================================================== 261. Simulated command *simulated-command* 27 28This command is in Vi, but Vim only simulates it: 29 30 *:o* *:op* *:open* 31:[range]o[pen] Works like |:visual|: end Ex mode. 32 {Vi: start editing in open mode} 33 34:[range]o[pen] /pattern/ As above, additionally move the cursor to the 35 column where "pattern" matches in the cursor 36 line. 37 38Vim does not support open mode, since it's not really useful. For those 39situations where ":open" would start open mode Vim will leave Ex mode, which 40allows executing the same commands, but updates the whole screen instead of 41only one line. 42 43============================================================================== 442. Missing options *missing-options* 45 46These options are in the Unix Vi, but not in Vim. If you try to set one of 47them you won't get an error message, but the value is not used and cannot be 48printed. 49 50autoprint (ap) boolean (default on) *'autoprint'* *'ap'* 51beautify (bf) boolean (default off) *'beautify'* *'bf'* 52flash (fl) boolean (default ??) *'flash'* *'fl'* 53graphic (gr) boolean (default off) *'graphic'* *'gr'* 54hardtabs (ht) number (default 8) *'hardtabs'* *'ht'* 55 number of spaces that a <Tab> moves on the display 56mesg boolean (default on) *'mesg'* 57novice boolean (default off) *'novice'* 58open boolean (default on) *'open'* 59optimize (op) boolean (default off) *'optimize'* *'op'* 60redraw boolean (default off) *'redraw'* 61slowopen (slow) boolean (default off) *'slowopen'* *'slow'* 62sourceany boolean (default off) *'sourceany'* 63w300 number (default 23) *'w300'* 64w1200 number (default 23) *'w1200'* 65w9600 number (default 23) *'w9600'* 66 67============================================================================== 683. Limits *limits* 69 70Vim has only a few limits for the files that can be edited {Vi: can not handle 71<Nul> characters and characters above 128, has limited line length, many other 72limits}. 73 *E340* 74Maximum line length On machines with 16-bit ints (Amiga and MS-DOS real 75 mode): 32767, otherwise 2147483647 characters. 76 Longer lines are split. 77Maximum number of lines 2147483647 lines. 78Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is 79 32 bits. Much more for 64 bit longs. Also limited 80 by available disk space for the |swap-file|. 81 *E75* 82Length of a file path Unix and Win32: 1024 characters, otherwise 256 83 characters (or as much as the system supports). 84Length of an expanded string option 85 Unix and Win32: 1024 characters, otherwise 256 86 characters 87Maximum display width Unix and Win32: 1024 characters, otherwise 255 88 characters 89Maximum lhs of a mapping 50 characters. 90Number of different highlighting types: over 30000 91Range of a Number variable: -2147483648 to 2147483647 (might be more on 64 92 bit systems) 93Maximum length of a line in a tags file: 512 bytes. 94 95Information for undo and text in registers is kept in memory, thus when making 96(big) changes the amount of (virtual) memory available limits the number of 97undo levels and the text that can be kept in registers. Other things are also 98kept in memory: Command-line history, error messages for Quickfix mode, etc. 99 100Memory usage limits 101------------------- 102 103The option 'maxmem' ('mm') is used to set the maximum memory used for one 104buffer (in kilobytes). 'maxmemtot' is used to set the maximum memory used for 105all buffers (in kilobytes). The defaults depend on the system used. For the 106Amiga and MS-DOS, 'maxmemtot' is set depending on the amount of memory 107available. 108These are not hard limits, but tell Vim when to move text into a swap file. 109If you don't like Vim to swap to a file, set 'maxmem' and 'maxmemtot' to a 110very large value. The swap file will then only be used for recovery. If you 111don't want a swap file at all, set 'updatecount' to 0, or use the "-n" 112argument when starting Vim. 113 114============================================================================== 1154. The most interesting additions *vim-additions* 116 117Vi compatibility. |'compatible'| 118 Although Vim is 99% Vi compatible, some things in Vi can be 119 considered to be a bug, or at least need improvement. But still, Vim 120 starts in a mode which behaves like the "real" Vi as much as possible. 121 To make Vim behave a little bit better, try resetting the 'compatible' 122 option: 123 :set nocompatible 124 Or start Vim with the "-N" argument: 125 vim -N 126 Vim starts with 'nocompatible' automatically if you have a .vimrc 127 file. See |startup|. 128 The 'cpoptions' option can be used to set Vi compatibility on/off for 129 a number of specific items. 130 131Support for different systems. 132 Vim can be used on: 133 - All Unix systems (it works on all systems it was tested on, although 134 the GUI and Perl interface may not work everywhere). 135 - Amiga (500, 1000, 1200, 2000, 3000, 4000, ...). 136 - MS-DOS in real-mode (no additional drivers required). 137 - In protected mode on Windows 3.1 and MS-DOS (DPMI driver required). 138 - Windows 95 and Windows NT, with support for long file names. 139 - OS/2 (needs emx.dll) 140 - Atari MiNT 141 - VMS 142 - BeOS 143 - Macintosh 144 - Risc OS 145 - IBM OS/390 146 Note that on some systems features need to be disabled to reduce 147 resource usage, esp. on MS-DOS. For some outdated systems you need to 148 use an older Vim version. 149 150Multi level persistent undo. |undo| 151 'u' goes backward in time, 'CTRL-R' goes forward again. Set option 152 'undolevels' to the number of changes to be remembered (default 1000). 153 Set 'undolevels' to 0 for a Vi-compatible one level undo. Set it to 154 -1 for no undo at all. 155 When all changes in a buffer have been undone, the buffer is not 156 considered changed anymore. You can exit it with :q, without <!>. 157 When undoing a few changes and then making a new change Vim will 158 create a branch in the undo tree. This means you can go back to any 159 state of the text, there is no risk of a change causing text to be 160 lost forever. |undo-tree| 161 The undo information is stored in a file when the 'undofile' option is 162 set. This means you can exit Vim, start Vim on a previously edited 163 file and undo changes that were made before exiting Vim. 164 165Graphical User Interface (GUI). |gui| 166 Included support for GUI: menu's, mouse, scrollbars, etc. You can 167 define your own menus. Better support for CTRL/SHIFT/ALT keys in 168 combination with special keys and mouse. Supported for various 169 platforms, such as X11 (with Motif and Athena interfaces), GTK, Win32 170 (Windows 95 and later), BeOS, Amiga and Macintosh. 171 172Multiple windows and buffers. |windows.txt| 173 Vim can split the screen into several windows, each editing a 174 different buffer or the same buffer at a different location. Buffers 175 can still be loaded (and changed) but not displayed in a window. This 176 is called a hidden buffer. Many commands and options have been added 177 for this facility. 178 Vim can also use multiple tab pages, each with one or more windows. A 179 line with tab labels can be used to quickly switch between these pages. 180 |tab-page| 181 182Terminal window. |:terminal| 183 Vim can create a window in which a terminal emulator runs. This can 184 be used to execute an arbitrary command, a shell or a debugger. 185 186Syntax highlighting. |:syntax| 187 Vim can highlight keywords, patterns and other things. This is 188 defined by a number of |:syntax| commands, and can be made to 189 highlight most languages and file types. A number of files are 190 included for highlighting the most common languages, like C, C++, 191 Java, Pascal, Makefiles, shell scripts, etc. The colors used for 192 highlighting can be defined for ordinary terminals, color terminals 193 and the GUI with the |:highlight| command. A convenient way to do 194 this is using a |:colorscheme| command. 195 The highlighted text can be exported as HTML. |convert-to-HTML| 196 Other items that can be highlighted are matches with the search string 197 |'hlsearch'|, matching parens |matchparen| and the cursor line and 198 column |'cursorline'| |'cursorcolumn'|. 199 200Text properties |textprop.txt| 201 Vim supports highlighting text by a plugin. Property types can be 202 specified with |prop_type_add()| and properties can be placed with 203 |prop_add()|. 204 205Spell checking. |spell| 206 When the 'spell' option is set Vim will highlight spelling mistakes. 207 About 50 languages are currently supported, selected with the 208 'spelllang' option. In source code only comments and strings are 209 checked for spelling. 210 211Folding. |folding| 212 A range of lines can be shown as one "folded" line. This allows 213 overviewing a file and moving blocks of text around quickly. 214 Folds can be created manually, from the syntax of the file, by indent, 215 etc. 216 217Diff mode. |diff| 218 Vim can show two versions of a file with the differences highlighted. 219 Parts of the text that are equal are folded away. Commands can be 220 used to move text from one version to the other. 221 222Plugins. |add-plugin| 223 The functionality can be extended by dropping a plugin file in the 224 right directory. That's an easy way to start using Vim scripts 225 written by others. Plugins can be for all kind of files, or 226 specifically for a filetype. 227 Packages make this even easier. |packages| 228 229Asynchronous communication and timers. |channel| |job| |timer| 230 Vim can exchange messages with other processes in the background. 231 This makes it possible to have servers do work and send back the 232 results to Vim. |channel| 233 Vim can start a job, communicate with it and stop it. |job| 234 Timers can fire once or repeatedly and invoke a function to do any 235 work. |timer| 236 237Repeat a series of commands. |q| 238 "q{c}" starts recording typed characters into named register {c}. 239 A subsequent "q" stops recording. The register can then be executed 240 with the "@{c}" command. This is very useful to repeat a complex 241 action. 242 243Flexible insert mode. |ins-special-special| 244 The arrow keys can be used in insert mode to move around in the file. 245 This breaks the insert in two parts as far as undo and redo is 246 concerned. 247 248 CTRL-O can be used to execute a single Normal mode command. This is 249 almost the same as hitting <Esc>, typing the command and doing |a|. 250 251Visual mode. |Visual-mode| 252 Visual mode can be used to first highlight a piece of text and then 253 give a command to do something with it. This is an (easy to use) 254 alternative to first giving the operator and then moving to the end of 255 the text to be operated upon. 256 |v| and |V| are used to start Visual mode. |v| works on characters 257 and |V| on lines. Move the cursor to extend the Visual area. It is 258 shown highlighted on the screen. By typing "o" the other end of the 259 Visual area can be moved. The Visual area can be affected by an 260 operator: 261 d delete 262 c change 263 y yank 264 > or < insert or delete indent 265 ! filter through external program 266 = filter through indent 267 : start |:| command for the Visual lines. 268 gq format text to 'textwidth' columns 269 J join lines 270 ~ swap case 271 u make lowercase 272 U make uppercase 273 {Vi has no Visual mode, the name "visual" is used for Normal mode, to 274 distinguish it from Ex mode} 275 276Block operators. |visual-block| 277 With Visual mode a rectangular block of text can be selected. Start 278 Visual mode with CTRL-V. The block can be deleted ("d"), yanked ("y") 279 or its case can be changed ("~", "u" and "U"). A deleted or yanked 280 block can be put into the text with the "p" and "P" commands. 281 282Help system. |:help| 283 Help is displayed in a window. The usual commands can be used to 284 move around, search for a string, etc. Tags can be used to jump 285 around in the help files, just like hypertext links. The |:help| 286 command takes an argument to quickly jump to the info on a subject. 287 <F1> is the quick access to the help system. The name of the help 288 index file can be set with the 'helpfile' option. 289 290Command-line editing and history. |cmdline-editing| 291 You can insert or delete at any place in the command-line using the 292 cursor keys. The right/left cursor keys can be used to move 293 forward/backward one character. The shifted right/left cursor keys 294 can be used to move forward/backward one word. CTRL-B/CTRL-E can be 295 used to go to the begin/end of the command-line. 296 {Vi: can only alter the last character in the line} 297 {Vi: when hitting <Esc> the command-line is executed. This is 298 unexpected for most people; therefore it was changed in Vim. But when 299 the <Esc> is part of a mapping, the command-line is executed. If you 300 want the Vi behaviour also when typing <Esc>, use ":cmap ^V<Esc> 301 ^V^M"} 302 |cmdline-history| 303 The command-lines are remembered. The up/down cursor keys can be used 304 to recall previous command-lines. The 'history' option can be set to 305 the number of lines that will be remembered. There is a separate 306 history for commands and for search patterns. 307 308Command-line completion. |cmdline-completion| 309 While entering a command-line (on the bottom line of the screen) 310 <Tab> can be typed to complete 311 what example ~ 312 - command :e<Tab> 313 - tag :ta scr<Tab> 314 - option :set sc<Tab> 315 - option value :set hf=<Tab> 316 - file name :e ve<Tab> 317 - etc. 318 319 If there are multiple matches, CTRL-N (next) and CTRL-P (previous) 320 will walk through the matches. <Tab> works like CTRL-N, but wraps 321 around to the first match. 322 323 The 'wildchar' option can be set to the character for command-line 324 completion, <Tab> is the default. CTRL-D can be typed after an 325 (incomplete) wildcard; all matches will be listed. CTRL-A will insert 326 all matches. CTRL-L will insert the longest common part of the 327 matches. 328 329Insert-mode completion. |ins-completion| 330 In Insert mode the CTRL-N and CTRL-P keys can be used to complete a 331 word that appears elsewhere. |i_CTRL-N| 332 With CTRL-X another mode is entered, through which completion can be 333 done for: 334 |i_CTRL-X_CTRL-F| file names 335 |i_CTRL-X_CTRL-K| words from 'dictionary' files 336 |i_CTRL-X_CTRL-T| words from 'thesaurus' files 337 |i_CTRL-X_CTRL-I| words from included files 338 |i_CTRL-X_CTRL-L| whole lines 339 |i_CTRL-X_CTRL-]| words from the tags file 340 |i_CTRL-X_CTRL-D| definitions or macros 341 |i_CTRL-X_CTRL-O| Omni completion: clever completion 342 specifically for a file type 343 etc. 344 345Long line support. |'wrap'| |'linebreak'| 346 If the 'wrap' option is off, long lines will not wrap and only part 347 of them will be shown. When the cursor is moved to a part that is not 348 shown, the screen will scroll horizontally. The minimum number of 349 columns to scroll can be set with the 'sidescroll' option. The |zh| 350 and |zl| commands can be used to scroll sideways. 351 Alternatively, long lines are broken in between words when the 352 'linebreak' option is set. This allows editing a single-line 353 paragraph conveniently (e.g. when the text is later read into a DTP 354 program). Move the cursor up/down with the |gk| and |gj| commands. 355 356Text formatting. |formatting| 357 The 'textwidth' option can be used to automatically limit the line 358 length. This supplements the 'wrapmargin' option of Vi, which was not 359 very useful. The |gq| operator can be used to format a piece of text 360 (for example, |gqap| formats the current paragraph). Commands for 361 text alignment: |:center|, |:left| and |:right|. 362 363Extended search patterns. |pattern| 364 There are many extra items to match various text items. Examples: 365 A "\n" can be used in a search pattern to match a line break. 366 "x\{2,4}" matches "x" 2 to 4 times. 367 "\s" matches a white space character. 368 369Directory, remote and archive browsing. |netrw| 370 Vim can browse the file system. Simply edit a directory. Move around 371 in the list with the usual commands and press <Enter> to go to the 372 directory or file under the cursor. 373 This also works for remote files over ftp, http, ssh, etc. 374 Zip and tar archives can also be browsed. |tar| |zip| 375 376Edit-compile-edit speedup. |quickfix| 377 The |:make| command can be used to run the compilation and jump to the 378 first error. A file with compiler error messages is interpreted. Vim 379 jumps to the first error. 380 381 Each line in the error file is scanned for the name of a file, line 382 number and error message. The 'errorformat' option can be set to a 383 list of scanf-like strings to handle output from many compilers. 384 385 The |:cn| command can be used to jump to the next error. 386 |:cl| lists all the error messages. Other commands are available. 387 The 'makeef' option has the name of the file with error messages. 388 The 'makeprg' option contains the name of the program to be executed 389 with the |:make| command. 390 The 'shellpipe' option contains the string to be used to put the 391 output of the compiler into the errorfile. 392 393Finding matches in files. |:vimgrep| 394 Vim can search for a pattern in multiple files. This uses the 395 advanced Vim regexp pattern, works on all systems and also works to 396 search in compressed files. 397 398Improved indenting for programs. |'cindent'| 399 When the 'cindent' option is on the indent of each line is 400 automatically adjusted. C syntax is mostly recognized. The indent 401 for various styles can be set with 'cinoptions'. The keys to trigger 402 indenting can be set with 'cinkeys'. 403 404 Comments can be automatically formatted. The 'comments' option can be 405 set to the characters that start and end a comment. This works best 406 for C code, but also works for e-mail (">" at start of the line) and 407 other types of text. The |=| operator can be used to re-indent 408 lines. 409 410 For many other languages an indent plugin is present to support 411 automatic indenting. |30.3| 412 413Searching for words in included files. |include-search| 414 The |[i| command can be used to search for a match of the word under 415 the cursor in the current and included files. The 'include' option 416 can be set to a pattern that describes a command to include a file 417 (the default is for C programs). 418 The |[I| command lists all matches, the |[_CTRL-I| command jumps to 419 a match. 420 The |[d|, |[D| and |[_CTRL-D| commands do the same, but only for 421 lines where the pattern given with the 'define' option matches. 422 423Automatic commands. |autocommand| 424 Commands can be automatically executed when reading a file, writing a 425 file, jumping to another buffer, etc., depending on the file name. 426 This is useful to set options and mappings for C programs, 427 documentation, plain text, e-mail, etc. This also makes it possible 428 to edit compressed files. 429 430Scripts and Expressions. |expression| 431 Commands have been added to form up a powerful script language. 432 |:if| Conditional execution, which can be used for example 433 to set options depending on the value of $TERM. 434 |:while| Repeat a number of commands. 435 |:for| Loop over a list. 436 |:echo| Print the result of an expression. 437 |:let| Assign a value to an internal variable, option, etc. 438 Variable types are Number, String, List and Dictionary. 439 |:execute| Execute a command formed by an expression. 440 |:try| Catch exceptions. 441 etc., etc. See |eval|. 442 Debugging and profiling are supported. |debug-scripts| |profile| 443 If this is not enough, an interface is provided to |Python|, |Ruby|, 444 |Tcl|, |Lua|, |Perl| and |MzScheme|. 445 446Viminfo. |viminfo-file| 447 The command-line history, marks and registers can be stored in a file 448 that is read on startup. This can be used to repeat a search command 449 or command-line command after exiting and restarting Vim. It is also 450 possible to jump right back to where the last edit stopped with |'0|. 451 The 'viminfo' option can be set to select which items to store in the 452 .viminfo file. This is off by default. 453 454Printing. |printing| 455 The |:hardcopy| command sends text to the printer. This can include 456 syntax highlighting. 457 458Mouse support. |mouse-using| 459 The mouse is supported in the GUI version, in an xterm for Unix, for 460 BSDs with sysmouse, for Linux with gpm, for MS-DOS, and Win32. It 461 can be used to position the cursor, select the visual area, paste a 462 register, etc. 463 464Usage of key names. |<>| |key-notation| 465 Special keys now all have a name like <Up>, <End>, etc. 466 This name can be used in mappings, to make it easy to edit them. 467 468Editing binary files. |edit-binary| 469 Vim can edit binary files. You can change a few characters in an 470 executable file, without corrupting it. Vim doesn't remove NUL 471 characters (they are represented as <NL> internally). 472 |-b| command-line argument to start editing a binary file 473 |'binary'| Option set by |-b|. Prevents adding an <EOL> for the 474 last line in the file. 475 476Multi-language support. |multi-lang| 477 Files in double-byte or multi-byte encodings can be edited. There is 478 UTF-8 support to be able to edit various languages at the same time, 479 without switching fonts. |UTF-8| 480 Messages and menus are available in different languages. 481 482Move cursor beyond lines. 483 When the 'virtualedit' option is set the cursor can move all over the 484 screen, also where there is no text. This is useful to edit tables 485 and figures easily. 486 487============================================================================== 4885. Other vim features *other-features* 489 490A random collection of nice extra features. 491 492 493When Vim is started with "-s scriptfile", the characters read from 494"scriptfile" are treated as if you typed them. If end of file is reached 495before the editor exits, further characters are read from the console. 496 497The "-w" option can be used to record all typed characters in a script file. 498This file can then be used to redo the editing, possibly on another file or 499after changing some commands in the script file. 500 501The "-o" option opens a window for each argument. "-o4" opens four windows. 502 503Vi requires several termcap entries to be able to work full-screen. Vim only 504requires the "cm" entry (cursor motion). 505 506 507In command mode: 508 509When the 'showcmd' option is set, the command characters are shown in the last 510line of the screen. They are removed when the command is finished. 511 512If the 'ruler' option is set, the current cursor position is shown in the 513last line of the screen. 514 515"U" still works after having moved off the last changed line and after "u". 516 517Characters with the 8th bit set are displayed. The characters between '~' and 5180xa0 are displayed as "~?", "~@", "~A", etc., unless they are included in the 519'isprint' option. 520 521"][" goes to the next ending of a C function ('}' in column 1). 522"[]" goes to the previous ending of a C function ('}' in column 1). 523 524"]f", "[f" and "gf" start editing the file whose name is under the cursor. 525CTRL-W f splits the window and starts editing the file whose name is under 526the cursor. 527 528"*" searches forward for the identifier under the cursor, "#" backward. 529"K" runs the program defined by the 'keywordprg' option, with the identifier 530under the cursor as argument. 531 532"%" can be preceded with a count. The cursor jumps to the line that 533percentage down in the file. The normal "%" function to jump to the matching 534brace skips braces inside quotes. 535 536With the CTRL-] command, the cursor may be in the middle of the identifier. 537 538The used tags are remembered. Commands that can be used with the tag stack 539are CTRL-T, ":pop" and ":tag". ":tags" lists the tag stack. 540 541Vi uses 'wrapscan' when searching for a tag. When jumping to a tag Vi starts 542searching in line 2 of another file. It does not find a tag in line 1 of 543another file when 'wrapscan' is not set. 544 545The 'tags' option can be set to a list of tag file names. Thus multiple 546tag files can be used. For file names that start with "./", the "./" is 547replaced with the path of the current file. This makes it possible to use a 548tags file in the same directory as the file being edited. 549{Vi: always uses binary search in some versions} 550{Vi does not have the security prevention for commands in tag files} 551 552Previously used file names are remembered in the alternate file name list. 553CTRL-^ accepts a count, which is an index in this list. 554":files" command shows the list of alternate file names. 555"#<N>" is replaced with the <N>th alternate file name in the list. 556"#<" is replaced with the current file name without extension. 557 558Search patterns have more features. The <NL> character is seen as part of the 559search pattern and the substitute string of ":s". Vi sees it as the end of 560the command. 561 562Searches can put the cursor on the end of a match and may include a character 563offset. 564 565Count added to "~", ":next", ":Next", "n" and "N". 566 567The command ":next!" with 'autowrite' set does not write the file. In vi the 568file was written, but this is considered to be a bug, because one does not 569expect it and the file is not written with ":rewind!". 570 571In Vi when entering a <CR> in replace mode deletes a character only when 'ai' 572is set (but does not show it until you hit <Esc>). Vim always deletes a 573character (and shows it immediately). 574 575Added :wnext command. Same as ":write" followed by ":next". 576 577The ":w!" command always writes, also when the file is write protected. In Vi 578you would have to do ":!chmod +w %:S" and ":set noro". 579 580When 'tildeop' has been set, "~" is an operator (must be followed by a 581movement command). 582 583With the "J" (join) command you can reset the 'joinspaces' option to have only 584one space after a period (Vi inserts two spaces). 585 586"cw" can be used to change white space formed by several characters (Vi is 587confusing: "cw" only changes one space, while "dw" deletes all white space). 588{Vi: "cw" when on a blank followed by other blanks changes only the first 589blank; this is probably a bug, because "dw" deletes all the blanks} 590 591"o" and "O" accept a count for repeating the insert (Vi clears a part of 592display). 593 594Flags after Ex commands not supported (no plans to include it). 595 596On non-UNIX systems ":cd" command shows current directory instead of going to 597the home directory (there isn't one). ":pwd" prints the current directory on 598all systems. 599 600After a ":cd" command the file names (in the argument list, opened files) 601still point to the same files. In Vi ":cd" is not allowed in a changed file; 602otherwise the meaning of file names change. 603 604":source!" command reads Vi commands from a file. 605 606":mkexrc" command writes current modified options and mappings to a ".exrc" 607file. ":mkvimrc" writes to a ".vimrc" file. 608 609No check for "tail recursion" with mappings. This allows things like 610":map! foo ^]foo". 611 612When a mapping starts with number, vi loses the count typed before it (e.g. 613when using the mapping ":map g 4G" the command "7g" goes to line 4). This is 614considered a vi bug. Vim concatenates the counts (in the example it becomes 615"74G"), as most people would expect. 616 617The :put! command inserts the contents of a register above the current line. 618 619The "p" and "P" commands of vi cannot be repeated with "." when the putted 620text is less than a line. In Vim they can always be repeated. 621 622":noremap" command can be used to enter a mapping that will not be remapped. 623This is useful to exchange the meaning of two keys. ":cmap", ":cunmap" and 624":cnoremap" can be used for mapping in command-line editing only. ":imap", 625":iunmap" and ":inoremap" can be used for mapping in insert mode only. 626Similar commands exist for abbreviations: ":noreabbrev", ":iabbrev" 627":cabbrev", ":iunabbrev", ":cunabbrev", ":inoreabbrev", ":cnoreabbrev". 628 629In Vi the command ":map foo bar" would remove a previous mapping 630":map bug foo". This is considered a bug, so it is not included in Vim. 631":unmap! foo" does remove ":map! bug foo", because unmapping would be very 632difficult otherwise (this is vi compatible). 633 634The ':' register contains the last command-line. 635The '%' register contains the current file name. 636The '.' register contains the last inserted text. 637 638":dis" command shows the contents of the yank registers. 639 640CTRL-O/CTRL-I can be used to jump to older/newer positions. These are the 641same positions as used with the '' command, but may be in another file. The 642":jumps" command lists the older positions. 643 644If the 'shiftround' option is set, an indent is rounded to a multiple of 645'shiftwidth' with ">" and "<" commands. 646 647The 'scrolljump' option can be set to the minimum number of lines to scroll 648when the cursor gets off the screen. Use this when scrolling is slow. 649 650The 'scrolloff' option can be set to the minimum number of lines to keep 651above and below the cursor. This gives some context to where you are 652editing. When set to a large number the cursor line is always in the middle 653of the window. 654 655Uppercase marks can be used to jump between files. The ":marks" command lists 656all currently set marks. The commands "']" and "`]" jump to the end of the 657previous operator or end of the text inserted with the put command. "'[" and 658"`[" do jump to the start. {Vi: no uppercase marks} 659 660The 'shelltype' option can be set to reflect the type of shell used on the 661Amiga. 662 663The 'highlight' option can be set for the highlight mode to be used for 664several commands. 665 666The CTRL-A (add) and CTRL-X (subtract) commands are new. The count to the 667command (default 1) is added to/subtracted from the number at or after the 668cursor. That number may be decimal, octal (starts with a '0') or hexadecimal 669(starts with '0x'). Very useful in macros. 670 671With the :set command the prefix "inv" can be used to invert boolean options. 672 673In both Vi and Vim you can create a line break with the ":substitute" command 674by using a CTRL-M. For Vi this means you cannot insert a real CTRL-M in the 675text. With Vim you can put a real CTRL-M in the text by preceding it with a 676CTRL-V. 677 678 679In Insert mode: 680 681If the 'revins' option is set, insert happens backwards. This is for typing 682Hebrew. When inserting normal characters the cursor will not be shifted and 683the text moves rightwards. Backspace, CTRL-W and CTRL-U will also work in 684the opposite direction. CTRL-B toggles the 'revins' option. In replace mode 685'revins' has no effect. Only when enabled at compile time. 686 687The backspace key can be used just like CTRL-D to remove auto-indents. 688 689You can backspace, CTRL-U and CTRL-W over line breaks if the 'backspace' (bs) 690option includes "eol". You can backspace over the start of insert if the 691'backspace' option includes "start". 692 693When the 'paste' option is set, a few options are reset and mapping in insert 694mode and abbreviation are disabled. This allows for pasting text in windowing 695systems without unexpected results. When the 'paste' option is reset, the old 696option values are restored. 697 698CTRL-T/CTRL-D always insert/delete an indent in the current line, no matter 699what column the cursor is in. 700 701CTRL-@ (insert previously inserted text) works always (Vi: only when typed as 702first character). 703 704CTRL-A works like CTRL-@ but does not leave insert mode. 705 706CTRL-R {0-9a-z..} can be used to insert the contents of a register. 707 708When the 'smartindent' option is set, C programs will be better auto-indented. 709With 'cindent' even more. 710 711CTRL-Y and CTRL-E can be used to copy a character from above/below the 712current cursor position. 713 714After CTRL-V you can enter a three digit decimal number. This byte value is 715inserted in the text as a single character. Useful for international 716characters that are not on your keyboard. 717 718When the 'expandtab' (et) option is set, a <Tab> is expanded to the 719appropriate number of spaces. 720 721The window always reflects the contents of the buffer (Vi does not do this 722when changing text and in some other cases). 723 724If Vim is compiled with DIGRAPHS defined, digraphs are supported. A set of 725normal digraphs is included. They are shown with the ":digraph" command. 726More can be added with ":digraph {char1}{char2} {number}". A digraph is 727entered with "CTRL-K {char1} {char2}" or "{char1} BS {char2}" (only when 728'digraph' option is set). 729 730When repeating an insert, e.g. "10atest <Esc>" vi would only handle wrapmargin 731for the first insert. Vim does it for all. 732 733A count to the "i" or "a" command is used for all the text. Vi uses the count 734only for one line. "3iabc<NL>def<Esc>" would insert "abcabcabc<NL>def" in Vi 735but "abc<NL>defabc<NL>defabc<NL>def" in Vim. 736 737 738In Command-line mode: 739 740<Esc> terminates the command-line without executing it. In vi the command 741line would be executed, which is not what most people expect (hitting <Esc> 742should always get you back to command mode). To avoid problems with some 743obscure macros, an <Esc> in a macro will execute the command. If you want a 744typed <Esc> to execute the command like vi does you can fix this with 745 ":cmap ^V<Esc> ^V<CR>" 746 747General: 748 749The 'ttimeout' option is like 'timeout', but only works for cursor and 750function keys, not for ordinary mapped characters. The 'timeoutlen' option 751gives the number of milliseconds that is waited for. If the 'esckeys' option 752is not set, cursor and function keys that start with <Esc> are not recognized 753in insert mode. 754 755There is an option for each terminal string. Can be used when termcap is not 756supported or to change individual strings. 757 758The 'fileformat' option can be set to select the <EOL>: "dos" <CR><NL>, "unix" 759<NL> or "mac" <CR>. 760When the 'fileformats' option is not empty, Vim tries to detect the type of 761<EOL> automatically. The 'fileformat' option is set accordingly. 762 763On systems that have no job control (older Unix systems and non-Unix systems) 764the CTRL-Z, ":stop" or ":suspend" command starts a new shell. 765 766If Vim is started on the Amiga without an interactive window for output, a 767window is opened (and :sh still works). You can give a device to use for 768editing with the |-d| argument, e.g. "-d con:20/20/600/150". 769 770The 'columns' and 'lines' options are used to set or get the width and height 771of the display. 772 773Option settings are read from the first and last few lines of the file. 774Option 'modelines' determines how many lines are tried (default is 5). Note 775that this is different from the Vi versions that can execute any Ex command 776in a modeline (a major security problem). |trojan-horse| 777 778If the 'insertmode' option is set (e.g. in .exrc), Vim starts in insert mode. 779And it comes back there, when pressing <Esc>. 780 781Undo information is kept in memory. Available memory limits the number and 782size of change that can be undone. This may be a problem with MS-DOS, is 783hardly a problem on the Amiga and almost never with Unix and Win32. 784 785If the 'backup' or 'writebackup' option is set: Before a file is overwritten, 786a backup file (.bak) is made. If the "backup" option is set it is left 787behind. 788 789Vim creates a file ending in ".swp" to store parts of the file that have been 790changed or that do not fit in memory. This file can be used to recover from 791an aborted editing session with "vim -r file". Using the swap file can be 792switched off by setting the 'updatecount' option to 0 or starting Vim with 793the "-n" option. Use the 'directory' option for placing the .swp file 794somewhere else. 795 796Vim is able to work correctly on filesystems with 8.3 file names, also when 797using messydos or crossdos filesystems on the Amiga, or any 8.3 mounted 798filesystem under Unix. See |'shortname'|. 799 800Error messages are shown at least one second (Vi overwrites error messages). 801 802If Vim gives the |hit-enter| prompt, you can hit any key. Characters other 803than <CR>, <NL> and <Space> are interpreted as the (start of) a command. 804{Vi: only ":" commands are interpreted} 805 806The contents of the numbered and unnamed registers is remembered when 807changing files. 808 809The "No lines in buffer" message is a normal message instead of an error 810message, since that may cause a mapping to be aborted. 811{Vi: error messages may be overwritten with other messages before you have a 812chance to read them} 813 814The AUX: device of the Amiga is supported. 815 816============================================================================== 8176. Supported Vi features *vi-features* 818 819Vim supports nearly all Vi commands and mostly in the same way. That is when 820the 'compatible' option is set and 'cpoptions' contains all flags. What the 821effect is of resetting 'compatible' and removing flags from 'cpoptions' can be 822found at the help for the specific command. 823 824The help files used to mark features that are in Vim but not in Vi with {not 825in Vi}. However, since these remarks cluttered the help files we now do it 826the other way around: Below is listed what Vi already supported. Anything 827else has been added by Vim. 828 829 830The following Ex commands are supported by Vi: ~ 831 832`:abbreviate` enter abbreviation 833`:append` append text 834`:args` print the argument list 835`:cd` change directory; Vi: no "cd -" 836`:change` replace a line or series of lines 837`:chdir` change directory 838`:copy` copy lines 839`:delete` delete lines 840`:edit` edit a file 841`:exit` same as `:xit` 842`:file` show or set the current file name; Vi: without the column number 843`:global` execute commands for matching lines 844`:insert` insert text 845`:join` join lines; Vi: not :join! 846`:k` set a mark 847`:list` print lines 848`:map` show or enter a mapping 849`:mark` set a mark 850`:move` move lines 851`:Next` go to previous file in the argument list {Vi: no count} 852`:next` go to next file in the argument list {Vi: no count} 853`:number` print lines with line number 854`:open` start open mode (not implemented in Vim) 855`:pop` jump to older entry in tag stack (only in some versions) 856`:preserve` write all text to swap file {Vi: might also exit} 857`:previous` same as `:Next` {Vi: only in some versions} 858`:print` print lines 859`:put` insert contents of register in the text 860`:quit` quit Vi 861`:read` read file into the text 862`:recover` recover a file from a swap file {Vi: recovers in another way 863 and sends mail if there is something to recover} 864`:rewind` go to the first file in the argument list; no ++opt 865`:set` set option; but not `:set inv{option}`, `:set option&`, 866 `:set all&`, `:set option+=value`, `:set option^=value` 867 `:set option-=value` `:set option<` 868`:shell` escape to a shell 869`:source` read Vi or Ex commands from a file 870`:stop` suspend the editor or escape to a shell 871`:substitute` find and replace text; Vi: no '&', 'i', 's', 'r' or 'I' flag, 872 confirm prompt only supports 'y' and 'n', no highlighting 873`:suspend` same as ":stop" 874`:t` same as ":copy" 875`:tag` jump to tag 876`:unabbreviate` remove abbreviation 877`:undo` undo last change {Vi: only one level} 878`:unmap` remove mapping 879`:vglobal` execute commands for not matching lines 880`:version` print version number and other info 881`:visual` same as ":edit", but turns off "Ex" mode 882`:wq` write to a file and quit Vi 883`:write` write to a file 884`:xit` write if buffer changed and quit Vi 885`:yank` yank lines into a register 886`:z` print some lines {not in all versions of Vi} 887`:!` filter lines or execute an external command 888`:"` comment 889`:#` same as ":number" 890`:*` execute contents of a register 891`:&` repeat last ":substitute" 892`:<` shift lines one 'shiftwidth' left 893`:=` print the cursor line number 894`:>` shift lines one 'shiftwidth' right 895`:@` execute contents of a register; but not `:@`; `:@@` only in 896 some versions 897 898Common for these commands is that Vi doesn't support the ++opt argument on 899`:edit` and other commands that open a file. 900 901 902The following Normal mode commands are supported by Vi: ~ 903 904note: See the beginning of |normal-index| for the meaning of WORD, N, Nmove 905and etc in the description text. 906 907|CTRL-B| scroll N screens Backwards 908|CTRL-C| interrupt current (search) command 909|CTRL-D| scroll Down N lines (default: half a screen); Vim scrolls 910 'scroll' screen lines, Vi scrolls file lines; makes a 911 difference when lines wrap 912|CTRL-E| scroll N lines upwards (N lines Extra) 913|CTRL-F| scroll N screens Forward 914|CTRL-G| display current file name and position 915|<BS>| same as "h" 916|CTRL-H| same as "h" 917|<NL>| same as "j" 918|CTRL-J| same as "j" 919|CTRL-L| redraw screen 920|<CR>| cursor to the first CHAR N lines lower 921|CTRL-M| same as <CR> 922|CTRL-N| same as "j" 923|CTRL-P| same as "k" 924|CTRL-R| in some Vi versions: same as CTRL-L 925|CTRL-T| jump to N older Tag in tag list 926|CTRL-U| N lines Upwards (default: half a screen) {Vi used file lines 927 while Vim scrolls 'scroll' screen lines; makes a difference 928 when lines wrap} 929|CTRL-Y| scroll N lines downwards 930|CTRL-Z| suspend program (or start new shell) 931|CTRL-]| :ta to ident under cursor {Vi: identifier after the cursor} 932|CTRL-^| edit alternate file {Vi: no count} 933|<Space>| same as "l" 934|!| filter Nmove text through the {filter} command 935|!!| filter N lines through the {filter} command 936" use register {a-zA-Z0-9.%#:-"} for next delete, yank or put 937 (uppercase to append) ({.%#:} only work with put) 938|$| cursor to the end of Nth next line 939|%| find the next (curly/square) bracket on this line and go to 940 its match, or go to matching comment bracket, or go to 941 matching preprocessor directive (Vi: no count supported) 942|&| repeat last :s 943|'| jump to mark (Vi: only lowercase marks) 944|(| cursor N sentences backward 945|)| cursor N sentences forward 946|+| same as <CR> 947|,| repeat latest f, t, F or T in opposite direction N times 948|-| cursor to the first CHAR N lines higher 949|.| repeat last change with count replaced with N 950|/| search forward for the Nth occurrence of {pattern} 951|0| cursor to the first char of the line 952|:| start entering an Ex command 953|;| repeat latest f, t, F or T N times 954|<| shift Nmove lines one 'shiftwidth' leftwards 955|<<| shift N lines one 'shiftwidth' leftwards 956|=| filter Nmove lines through "indent" 957|==| filter N lines through "indent" 958|>| shift Nmove lines one 'shiftwidth' rightwards 959|>>| shift N lines one 'shiftwidth' rightwards 960|?| search backward for the Nth previous occurrence of {pattern} 961|@| execute the contents of register {a-z} N times 962 {Vi: only named registers} 963|@@| repeat the previous @{a-z} N times 964|A| append text after the end of the line N times 965|B| cursor N WORDS backward 966|C| change from the cursor position to the end of the line 967|D| delete the characters under the cursor until the end of the 968 line and N-1 more lines [into register x]; synonym for "d$" 969|E| cursor forward to the end of WORD N 970|F| cursor to the Nth occurrence of {char} to the left 971|G| cursor to line N, default last line 972|H| cursor to line N from top of screen 973|I| insert text before the first CHAR on the line N times 974|J| Join N lines; default is 2 975|L| cursor to line N from bottom of screen 976|M| cursor to middle line of screen 977|N| repeat the latest '/' or '?' N times in opposite direction 978|O| begin a new line above the cursor and insert text, repeat N 979 times {Vi: blank [count] screen lines} 980|P| put the text [from register x] before the cursor N times 981 {Vi: no count} 982|Q| switch to "Ex" mode 983|R| enter replace mode: overtype existing characters, repeat the 984 entered text N-1 times 985|S| delete N lines [into register x] and start insert; synonym for 986 "cc". 987|T| cursor till after Nth occurrence of {char} to the left 988|U| undo all latest changes on one line 989 {Vi: while not moved off of the last modified line} 990|W| cursor N WORDS forward 991|X| delete N characters before the cursor [into register x] 992|Y| yank N lines [into register x]; synonym for "yy" 993|ZZ| store current file if modified, and exit 994|[[| cursor N sections backward 995|]]| cursor N sections forward 996|^| cursor to the first CHAR of the line 997|_| cursor to the first CHAR N - 1 lines lower 998|`| cursor to the mark {a-zA-Z0-9} 999|a| append text after the cursor N times 1000|b| cursor N words backward 1001|c| delete Nmove text [into register x] and start insert 1002|cc| delete N lines [into register x] and start insert 1003|d| delete Nmove text [into register x] 1004|dd| delete N lines [into register x] 1005|e| cursor forward to the end of word N 1006|f| cursor to Nth occurrence of {char} to the right 1007|h| cursor N chars to the left 1008|i| insert text before the cursor N times 1009|j| cursor N lines downward 1010|k| cursor N lines upward 1011|l| cursor N chars to the right 1012|m| set mark {A-Za-z} at cursor position 1013|n| repeat the latest '/' or '?' N times 1014|o| begin a new line below the cursor and insert text 1015 {Vi: blank [count] screen lines} 1016|p| put the text [from register x] after the cursor N times 1017 {Vi: no count} 1018|r| replace N chars with {char} {Vi: CTRL-V <CR> still replaces 1019 with a line break, cannot replace something with a <CR>} 1020|s| (substitute) delete N characters [into register x] and start 1021 insert 1022|t| cursor till before Nth occurrence of {char} to the right 1023|u| undo changes {Vi: only one level} 1024|w| cursor N words forward 1025|x| delete N characters under and after the cursor [into register 1026 x] 1027|y| yank Nmove text [into register x] 1028|yy| yank N lines [into register x] 1029|z<CR>| current line to the top 1030|z-| current line to the bottom 1031|z+| cursor on line N 1032|z^| cursor on line N 1033|{| cursor N paragraphs backward 1034| cursor to column N 1035|}| cursor N paragraphs forward 1036|~| switch case of N characters under the cursor; Vim: depends on 1037 'tildeop' {Vi: no count, no 'tildeop'} 1038|<Del>| same as "x" 1039 1040 1041The following commands are supported in Insert mode by Vi: ~ 1042 1043CTRL-@ insert previously inserted text and stop insert 1044 {Vi: only when typed as first char, only up to 128 chars} 1045CTRL-C quit insert mode, without checking for abbreviation, unless 1046 'insertmode' set. 1047CTRL-D delete one shiftwidth of indent in the current line 1048 {Vi: CTRL-D works only when used after autoindent} 1049<BS> delete character before the cursor {Vi: does not delete 1050 autoindents, does not cross lines, does not delete past start 1051 position of insert} 1052CTRL-H same as <BS> 1053<Tab> insert a <Tab> character 1054CTRL-I same as <Tab> 1055<NL> same as <CR> 1056CTRL-J same as <CR> 1057<CR> begin new line 1058CTRL-M same as <CR> 1059CTRL-T insert one shiftwidth of indent in current line {Vi: only when 1060 in indent} 1061CTRL-V {char} insert next non-digit literally {Vi: no decimal byte entry} 1062CTRL-W delete word before the cursor 1063CTRL-Z when 'insertmode' set: suspend Vi 1064<Esc> end insert mode (unless 'insertmode' set) 1065CTRL-[ same as <Esc> 10660 CTRL-D delete all indent in the current line 1067^ CTRL-D delete all indent in the current line, restore it in the next 1068 line 1069<Del> delete character under the cursor 1070 1071 1072The following options are supported by Vi: ~ 1073 1074'autoindent' 'ai' take indent for new line from previous line 1075 {Vi does this slightly differently: After the 1076 indent is deleted when typing <Esc> or <CR>, the 1077 cursor position when moving up or down is after 1078 the deleted indent; Vi puts the cursor somewhere 1079 in the deleted indent}. 1080'autowrite' 'aw' automatically write file if changed 1081'directory' 'dir' list of directory names for the swap file 1082 {Vi: directory to put temp file in, defaults to 1083 "/tmp"} 1084'edcompatible' 'ed' toggle flags of ":substitute" command 1085'errorbells' 'eb' ring the bell for error messages 1086'ignorecase' 'ic' ignore case in search patterns 1087'lines' number of lines in the display 1088'lisp' automatic indenting for Lisp {Vi: Does it a little 1089 bit differently} 1090'list' show <Tab> and <EOL> 1091'magic' changes special characters in search patterns 1092'modeline' 'ml' recognize 'modelines' at start or end of file 1093 {called modelines in some Vi versions} 1094'number' 'nu' print the line number in front of each line 1095'paragraphs' 'para' nroff macros that separate paragraphs 1096'prompt' 'prompt' enable prompt in Ex mode 1097'readonly' 'ro' disallow writing the buffer {Vim sets 'readonly' 1098 when editing a file with `:view`} 1099'remap' allow mappings to work recursively 1100'report' threshold for reporting nr. of lines changed 1101'scroll' 'scr' lines to scroll with CTRL-U and CTRL-D 1102'sections' 'sect' nroff macros that separate sections 1103'shell' 'sh' name of shell to use for external commands 1104'shiftwidth' 'sw' number of spaces to use for (auto)indent step 1105'showmatch' 'sm' briefly jump to matching bracket if insert one 1106'showmode' 'smd' message on status line to show current mode 1107'tabstop' 'ts' number of spaces that <Tab> in file uses 1108'taglength' 'tl' number of significant characters for a tag 1109'tags' 'tag' list of file names used by the tag command 1110 {Vi: default is "tags /usr/lib/tags"} 1111'tagstack' 'tgst' push tags onto the tag stack {not in all versions 1112 of Vi} 1113'term' name of the terminal 1114'terse' shorten some messages 1115'timeout' 'to' time out on mappings and key codes 1116'timeoutlen' 'tm' time for 'timeout' {only in some Vi versions} 1117'ttytype' 'tty' alias for 'term' 1118'verbose' 'vbs' give informative messages {only in some Vi 1119 versions as a boolean option} 1120'warn' warn for shell command when buffer was changed 1121'window' 'wi' nr of lines to scroll for CTRL-F and CTRL-B 1122 {Vi also uses the option to specify the number of 1123 displayed lines} 1124'wrapmargin' 'wm' chars from the right where wrapping starts 1125 {Vi: works differently and less usefully} 1126'wrapscan' 'ws' searches wrap around the end of the file 1127'writeany' 'wa' write to file with no need for "!" override 1128 1129Also see |missing-options|. 1130 1131============================================================================== 11327. Command-line arguments *cmdline-arguments* 1133 1134Different versions of Vi have different command-line arguments. This can be 1135confusing. To help you, this section gives an overview of the differences. 1136 1137Five variants of Vi will be considered here: 1138 Elvis Elvis version 2.1b 1139 Nvi Nvi version 1.79 1140 Posix Posix 1003.2 1141 Vi Vi version 3.7 (for Sun 4.1.x) 1142 Vile Vile version 7.4 (incomplete) 1143 Vim Vim version 5.2 1144 1145Only Vim is able to accept options in between and after the file names. 1146 1147+{command} Elvis, Nvi, Posix, Vi, Vim: Same as "-c {command}". 1148 1149- Nvi, Posix, Vi: Run Ex in batch mode. 1150 Vim: Read file from stdin (use -s for batch mode). 1151 1152-- Vim: End of options, only file names are following. 1153 1154--cmd {command} Vim: execute {command} before sourcing vimrc files. 1155 1156--echo-wid Vim: GTK+ echoes the Window ID on stdout 1157 1158--help Vim: show help message and exit. 1159 1160--literal Vim: take file names literally, don't expand wildcards. 1161 1162--nofork Vim: same as |-f| 1163 1164--noplugin[s] Vim: Skip loading plugins. 1165 1166--remote Vim: edit the files in another Vim server 1167 1168--remote-expr {expr} Vim: evaluate {expr} in another Vim server 1169 1170--remote-send {keys} Vim: send {keys} to a Vim server and exit 1171 1172--remote-silent {file} Vim: edit the files in another Vim server if possible 1173 1174--remote-wait Vim: edit the files in another Vim server and wait for it 1175 1176--remote-wait-silent Vim: like --remote-wait, no complaints if not possible 1177 1178--role {role} Vim: GTK+ 2: set role of main window 1179 1180--serverlist Vim: Output a list of Vim servers and exit 1181 1182--servername {name} Vim: Specify Vim server name 1183 1184--socketid {id} Vim: GTK window socket to run Vim in 1185 1186--windowid {id} Vim: Win32 window ID to run Vim in 1187 1188--version Vim: show version message and exit. 1189 1190-? Vile: print usage summary and exit. 1191 1192-a Elvis: Load all specified file names into a window (use -o for 1193 Vim). 1194 1195-A Vim: Start in Arabic mode (when compiled with Arabic). 1196 1197-b {blksize} Elvis: Use {blksize} blocksize for the session file. 1198-b Vim: set 'binary' mode. 1199 1200-C Vim: Compatible mode. 1201 1202-c {command} Elvis, Nvi, Posix, Vim: run {command} as an Ex command after 1203 loading the edit buffer. 1204 Vim: allow up to 10 "-c" arguments 1205 1206-d {device} Vim: Use {device} for I/O (Amiga only). {only when compiled 1207 without the |+diff| feature} 1208-d Vim: start with 'diff' set. |vimdiff| 1209 1210-dev {device} Vim: Use {device} for I/O (Amiga only). 1211 1212-D Vim: debug mode. 1213 1214-e Elvis, Nvi, Vim: Start in Ex mode, as if the executable is 1215 called "ex". 1216 1217-E Vim: Start in improved Ex mode |gQ|, like "exim". 1218 1219-f Vim: Run GUI in foreground (Amiga: don't open new window). 1220-f {session} Elvis: Use {session} as the session file. 1221 1222-F Vim: Start in Farsi mode (when compiled with Farsi). 1223 Nvi: Fast start, don't read the entire file when editing 1224 starts. 1225 1226-G {gui} Elvis: Use the {gui} as user interface. 1227 1228-g Vim: Start GUI. 1229-g N Vile: start editing at line N 1230 1231-h Vim: Give help message. 1232 Vile: edit the help file 1233 1234-H Vim: start Hebrew mode (when compiled with it). 1235 1236-i Elvis: Start each window in Insert mode. 1237-i {viminfo} Vim: Use {viminfo} for viminfo file. 1238 1239-L Vim: Same as "-r" {only in some versions of Vi: "List 1240 recoverable edit sessions"}. 1241 1242-l Nvi, Vi, Vim: Set 'lisp' and 'showmatch' options. 1243 1244-m Vim: Modifications not allowed to be written, resets 'write' 1245 option. 1246 1247-M Vim: Modifications not allowed, resets 'modifiable' and the 1248 'write' option. 1249 1250-N Vim: No-compatible mode. 1251 1252-n Vim: No swap file used. 1253 1254-nb[args] Vim: open a NetBeans interface connection 1255 1256-O[N] Vim: Like -o, but use vertically split windows. 1257 1258-o[N] Vim: Open [N] windows, or one for each file. 1259 1260-p[N] Vim: Open [N] tab pages, or one for each file. 1261 1262-P {parent-title} Win32 Vim: open Vim inside a parent application window 1263 1264-q {name} Vim: Use {name} for quickfix error file. 1265-q{name} Vim: Idem. 1266 1267-R Elvis, Nvi, Posix, Vile, Vim: Set the 'readonly' option. 1268 1269-r Elvis, Nvi, Posix, Vi, Vim: Recovery mode. 1270 1271-S Nvi: Set 'secure' option. 1272-S {script} Vim: source script after starting up. 1273 1274-s Nvi, Posix, Vim: Same as "-" (silent mode), when in Ex mode. 1275 Elvis: Sets the 'safer' option. 1276-s {scriptin} Vim: Read from script file {scriptin}; only when not in Ex 1277 mode. 1278-s {pattern} Vile: search for {pattern} 1279 1280-t {tag} Elvis, Nvi, Posix, Vi, Vim: Edit the file containing {tag}. 1281-t{tag} Vim: Idem. 1282 1283-T {term} Vim: Set terminal name to {term}. 1284 1285-u {vimrc} Vim: Read initializations from {vimrc} file. 1286 1287-U {gvimrc} Vim: Read GUI initializations from {gvimrc} file. 1288 1289-v Nvi, Posix, Vi, Vim: Begin in Normal mode (visual mode, in Vi 1290 terms). 1291 Vile: View mode, no changes possible. 1292 1293-V Elvis, Vim: Verbose mode. 1294-V{nr} Vim: Verbose mode with specified level. 1295 1296-w {size} Elvis, Posix, Nvi, Vi, Vim: Set value of 'window' to {size}. 1297-w{size} Nvi, Vi: Same as "-w {size}". 1298-w {name} Vim: Write to script file {name} (must start with non-digit). 1299 1300-W {name} Vim: Append to script file {name}. 1301 1302-x Vi, Vim: Ask for encryption key. See |encryption|. 1303 1304-X Vim: Don't connect to the X server. 1305 1306-y Vim: Start in easy mode, like |evim|. 1307 1308-Z Vim: restricted mode 1309 1310@{cmdfile} Vile: use {cmdfile} as startup file. 1311 1312============================================================================== 13138. POSIX compliance *posix* *posix-compliance* 1314 1315In 2005 the POSIX test suite was run to check the compatibility of Vim. Most 1316of the test was executed properly. There are the few things where Vim 1317is not POSIX compliant, even when run in Vi compatibility mode. 1318 *$VIM_POSIX* 1319Set the $VIM_POSIX environment variable to have 'cpoptions' include the POSIX 1320flags when Vim starts up. This makes Vim run as POSIX as it can. That's 1321a bit different from being Vi compatible. 1322 1323This is where Vim does not behave as POSIX specifies and why: 1324 1325 *posix-screen-size* 1326 The $COLUMNS and $LINES environment variables are ignored by Vim if 1327 the size can be obtained from the terminal in a more reliable way. 1328 Add the '|' flag to 'cpoptions' to have $COLUMNS and $LINES overrule 1329 sizes obtained in another way. 1330 1331 The "{" and "}" commands don't stop at a "{" in the original Vi, but 1332 POSIX specifies it does. Add the '{' flag to 'cpoptions' if you want 1333 it the POSIX way. 1334 1335 The "D", "o" and "O" commands accept a count. Also when repeated. 1336 Add the '#' flag to 'cpoptions' if you want to ignore the count. 1337 1338 The ":cd" command fails if the current buffer is modified when the '.' 1339 flag is present in 'cpoptions'. 1340 1341 There is no ATTENTION message, the "A" flag is added to 'shortmess'. 1342 1343These are remarks about running the POSIX test suite: 1344- vi test 33 sometimes fails for unknown reasons 1345- vi test 250 fails; behavior will be changed in a new revision 1346 http://www.opengroup.org/austin/mailarchives/ag-review/msg01710.html 1347 (link no longer works, perhaps it's now: 1348 https://www.opengroup.org/sophocles/show_mail.tpl?CALLER=show_archive.tpl&source=L&listname=austin-review-l&id=1711) 1349- vi test 310 fails; exit code non-zero when any error occurred? 1350- ex test 24 fails because test is wrong. Changed between SUSv2 and SUSv3. 1351- ex tests 47, 48, 49, 72, 73 fail because .exrc file isn't read in silent 1352 mode and $EXINIT isn't used. 1353- ex tests 76, 78 fail because echo is used instead of printf. (fixed) 1354 Also: problem with \s not changed to space. 1355- ex test 355 fails because 'window' isn't used for "30z". 1356- ex test 368 fails because shell command isn't echoed in silent mode. 1357- ex test 394 fails because "=" command output isn't visible in silent mode. 1358- ex test 411 fails because test file is wrong, contains stray ':'. 1359- ex test 475 and 476 fail because reprint output isn't visible in silent mode. 1360- ex test 480 and 481 fail because the tags file has spaces instead of a tab. 1361- ex test 502 fails because .exrc isn't read in silent mode. 1362- ex test 509 fails because .exrc isn't read in silent mode. and exit code is 1363 1 instead of 2. 1364- ex test 534 fails because .exrc isn't read in silent mode. 1365 1366 1367 vim:tw=78:ts=8:noet:ft=help:norl: 1368