📄 vi_diff.txt
字号:
*vi_diff.txt* For Vim version 5.8. Last change: 2000 Aug 11 VIM REFERENCE MANUAL by Bram MoolenaarDifferences between Vim and Vi *vi-differences*Throughout the help files differences between Vim and Vi/Ex are given incurly braces, like "{not in Vi}". This file only lists what has not beenmentioned in other files and gives an overview.Vim is mostly POSIX 1003.2-1 compliant. The only command known to be missingis ":open". There are probably a lot of small differences.1. Missing commands |missing-commands|2. Missing options |missing-options|3. Limits |limits|4. The most interesting additions |vim-additions|5. Other vim features |other-features|6. Command-line arguments |cmdline-arguments|==============================================================================1. Missing commands *missing-commands*This command is in Vi, but not in Vim::o[pen] {Vi: start editing in open mode} *:o* *:op* *:open*==============================================================================2. Missing options *missing-options*These options are in the Unix Vi, but not in Vim. If you try to set one ofthem you won't get an error message, but the value is not used and cannot beprinted.autoprint (ap) boolean (default on) *'autoprint'* *'ap'*beautify (bf) boolean (default off) *'beautify'* *'bf'*flash (fl) boolean (default ??) *'flash'* *'fl'*graphic (gr) boolean (default off) *'graphic'* *'gr'*hardtabs (ht) number (default 8) *'hardtabs'* *'ht'* number of spaces that a <Tab> moves on the displaymesg boolean (default on) *'mesg'*novice boolean (default ??) *'novice'*open boolean (default on) *'open'*optimize (op) boolean (default off) *'optimize'* *'op'*prompt boolean (default on) *'prompt'*redraw boolean (default off) *'redraw'*slowopen (slow) boolean (default off) *'slowopen'* *'slow'*sourceany boolean (default off) *'sourceany'*window (wi) number (default 23) *'window'* *'wi'*w300 number (default 23) *'w300'*w1200 number (default 23) *'w1200'*w9600 number (default 23) *'w9600'*==============================================================================3. Limits *limits*Vim has only a few limits for the files that can be edited {Vi: can not handle<Nul> characters and characters above 128, has limited line length, many otherlimits}.Maximum line length On machines with 16-bit ints (Amiga and MS-DOS real mode): 32767, otherwise 2147483647 characters. Longer lines are split.Maximum number of lines 2147483647 lines.Maximum file size 2147483647 bytes (2 Gbyte) when a long integer is 32 bits. Much more for 64 bit longs. Also limited by available disk space for the |swap-file|.Length of a file path Unix and Win32: 1024 characters, otherwise 256 characters (or as much as the system supports).Length of an expanded string option Unix and Win32: 1024 characters, otherwise 256 charactersMaximum display width Unix and Win32: 1024 characters, otherwise 255 charactersMaximum lhs of a mapping 50 characters.Information for undo and text in registers is kept in memory, thus when making(big) changes the amount of (virtual) memory available limits the number ofundo levels and the text that can be kept in registers. Other things are alsokept in memory: Command-line history, error messages for Quickfix mode, etc.Memory usage limits-------------------The option 'maxmem' ('mm') is used to set the maximum memory used for onebuffer (in kilobytes). 'maxmemtot' is used to set the maximum memory used forall buffers (in kilobytes). The defaults depend on the system used. For theAmiga and MS-DOS, 'maxmemtot' is set depending on the amount of memoryavailable. If you don't like Vim to swap to a file, set 'maxmem' and'maxmemtot' to a very large value. The swap file will then only be used forrecovery. If you don't want a swap file at all, set 'updatecount' to 0, oruse the "-n" argument when starting Vim. Note that the 'maxmem' option isonly used when a buffer is created. Changing this option does not affectbuffers that have already been loaded. Thus you can set it to differentvalues for different files. 'maxmemtot' works always.==============================================================================4. The most interesting additions *vim-additions*Vi compatibility. |'compatible'| Although Vim is 99% Vi compatible, some things in Vi can be considered to be a bug, or at least need improvement. But still, Vim starts in a mode which behaves like the "real" Vi as much as possible. To make Vim behave a little bit better, try resetting the 'compatible' option: :set nocompatible Or start Vim with the "-N" argument: vim -N This is done automatically if you have a .vimrc file. See |startup|. The 'cpoptions' option can be used to set Vi compatibility on/off for a number of specific items. |'cpoptions'|Support for different systems. Vim can be used on: - All Unix systems (it works on all systems it was tested on, although the GUI and Perl interface may not work everywhere). - Amiga (500, 1000, 1200, 2000, 3000, 4000, ...). - MS-DOS in real-mode (no additional drivers required). - In protected mode on Windows 3.1 and MS-DOS (DPMI driver required). - Windows 95 and Windows NT, with support for long file names. - OS/2 (needs emx.dll) - Atari MiNT - VMS - BeOS - Macintosh (although there is no binary available, needs some work)Multi level undo. |undo| 'u' goes backward in time, 'ctrl-R' goes forward again. Set option 'undolevels' to the number of changes to be remembered (default 1000). Set 'undolevels' to 0 for a vi-compatible one level undo. Set it to -1 for no undo at all. When all changes in a buffer have been undone, the buffer is not considered changed anymore. You can exit it with :q, without <!>.Graphical User Interface (GUI) |gui| Included support for GUI: menu's, mouse, scrollbars, etc. You can define your own menus. Better support for CTRL/SHIFT/ALT keys in combination with special keys and mouse. Currently for X11 (with Motif and Athena interfaces), Win32 (Windows 95 and Windows NT), BeOS, Amiga and Macintosh.Multiple windows and buffers. |windows.txt| Vim can split the screen into several windows, each editing a different buffer or the same buffer at a different location. Buffers can still be loaded (and changed) but not displayed in a window. This is called a hidden buffer. Many commands and options have been added for this facility.Syntax highlighting. |:syntax| Vim can highlight keywords, patterns and other things. This is defined by a number of ":syntax" commands, and can be made to highlight most languages and file types. A number of files are included for highlighting the most common languages, like C, C++, Java, Pascal, Makefiles, shell scripts, etc. The colors used for highlighting can be defined for ordinary terminals, color terminals and the GUI with the ":highlight" command.Repeat a series of commands. |q| 'q'{c} starts recording typed characters into named register {c} (append to the register if register name is upper case). A subsequent 'q' stops recording. The register can then be executed with the '@'{c} command. This is very useful to repeat a complex action.Flexible insert mode. |ins-special-special| The arrow keys can be used in insert mode to move around in the file. This breaks the insert in two parts as far as undo and redo is concerned. CTRL-O can be used to execute a single command-mode command. This is almost the same as hitting <Esc>, typing the command and hitting 'a'.Visual mode. |Visual-mode| Visual can be used to first highlight a piece of text and then give a command to do something with it. This is an (easy to use) alternative to first giving the operator and then moving to the end of the text to be operated upon. 'v' and 'V' are used to start Visual mode. 'v' works on characters and 'V' on lines. Move the cursor to extend the Visual part. It is shown highlighted on the screen. By typing 'o' the other end of the Visual text can be moved. The Visual text can be affected by an operator: d delete c change y yank > or < insert or delete indent ! filter through external program = filter through indent : start ":" command for the Visual lines. gq format text to 'textwidth' columns J join lines ~ swap case u make lowercase U make uppercaseBlock operators. |visual-block| With Visual a rectangular block of text can be selected. Start Visual with CTRL-V. The block can be deleted ('d'), yanked ('y') or its case can be changed ('~', 'u' and 'U'). A deleted or yanked block can be put into the text with the 'p' and 'P' commands.Online help system. |:help| Help is displayed in a window. The usual commands can be used to move around, search for a string, etc. Tags can be used to jump around in the help files, just like hypertext links. The ":help" command takes an argument to quickly jump to the info on a subject. <F1> is the quick access to the help system. The name of the help index file can be set with the 'helpfile' option.Command-line editing and history. |cmdline-editing| You can insert or delete at any place in the command-line using the cursor keys. The right/left cursor keys can be used to move forward/backward one character. The shifted right/left cursor keys can be used to move forward/backward one word. CTRL-B/CTRL-E can be used to go to the begin/end of the command-line. |cmdline-history| The command-lines are remembered. The up/down cursor keys can be used to recall previous command-lines. The 'history' option can be set to the number of lines that will be remembered. There is a separate history for commands and for search patterns.Command-line completion. |cmdline-completion| While entering a command-line (on the bottom line of the screen) <Tab> can be typed to complete what example ~ - command :e<Tab> - tag :ta scr<Tab> - option :set sc<Tab> - option value :set hf=<Tab> - file name :e ve<Tab> - etc. If there are multiple matches, CTRL-N (next) and CTRL-P (previous) will walk through the matches. <Tab> works like CTRL-N, but wraps around to the first match. The 'wildchar' option can be set to the character for command-line completion, <Tab> is the default. CTRL-D can be typed after an (incomplete) wildcard; all matches will be listed. CTRL-A will insert all matches. CTRL-L will insert the longest common part of the matches.Insert-mode completion |ins-completion| In insert mode the CTRL-N and CTRL-P keys can be used to complete a word that has previously been used. |i_CTRL-N| With CTRL-X another mode is entered, through which completion can be done for: |i_CTRL-X_CTRL-F| file names |i_CTRL-X_CTRL-K| words from a dictionary |i_CTRL-X_CTRL-I| words from included files |i_CTRL-X_CTRL-L| whole lines |i_CTRL-X_CTRL-]| words from the tags file |i_CTRL-X_CTRL-D| definitions or macrosLong line support |'wrap'| |'linebreak'| If the 'wrap' option is off, long lines will not wrap and only part of them will be shown. When the cursor is moved to a part that is not shown, the screen will scroll horizontally. The minimum number of columns to scroll can be set with the 'sidescroll' option. The "zh" and "zl" commands can be used to scroll sideways. Alternatively, long lines are broken in between words when the 'linebreak' option is set. This allows editing a single-line
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -