📄 vi_diff.txt
字号:
With the :set command the prefix "inv" can be used to invert boolean options.In both Vi and Vim you can create a line break with the ":substitute" commandby using a CTRL-M. For Vi this means you cannot insert a real CTRL-M in thetext. With Vim you can put a real CTRL-M in the text by preceding it with aCTRL-V.In Insert mode:If the 'revins' option is set, insert happens backwards. This is for typingHebrew. When inserting normal characters the cursor will not be shifted andthe text moves rightwards. Backspace, CTRL-W and CTRL-U will also work inthe opposite direction. CTRL-B toggles the 'revins' option. In replace mode'revins' has no effect. Only when enabled at compile time.The backspace key can be used just like CTRL-D to remove auto-indents.You can backspace, ctrl-U and CTRL-W over line breaks if the 'backspace' (bs)option includes "eol". You can backspace over the start of insert if the'backspace' option includes "start".When the 'paste' option is set, a few option are reset and mapping in insertmode and abbreviation are disabled. This allows for pasting text in windowingsystems without unexpected results. When the 'paste' option is reset, the oldoption values are restored.CTRL-T/CTRL-D always insert/delete an indent in the current line, no matterwhat column the cursor is in.CTRL-@ (insert previously inserted text) works always (Vi: only when typed asfirst character).CTRL-A works like CTRL-@ but does not leave insert mode.CTRL-R {0-9a-z..} can be used to insert the contents of a register.When the 'smartindent' option is set, C programs will be better auto-indented.With 'cindent' even more.CTRL-Y and CTRL-E can be used to copy a character from above/below thecurrent cursor position.After CTRL-V you can enter a three digit decimal number. This byte value isinserted in the text as a single character. Useful for internationalcharacters that are not on your keyboard.When the 'expandtab' (et) option is set, a <Tab> is expanded to theappropriate number of spaces.The window always reflects the contents of the buffer (Vi does not do thiswhen changing text and in some other cases).If Vim is compiled with DIGRAPHS defined, digraphs are supported. A set ofnormal digraphs is included. They are shown with the ":digraph" command.More can be added with ":digraph {char1}{char2} {number}". A digraph isentered with "CTRL-K {char1} {char2}" or "{char1} BS {char2}" (only when'digraph' option is set).When repeating an insert, e.g. "10atest <Esc>" vi would only handle wrapmarginfor the first insert. Vim does it for all.A count to the 'i' or 'a' command is used for all the text. Vi uses the countonly for one line. "3iabc<NL>def<Esc>" would insert "abcabcacc<NL>def" in Vibut "abc<NL>defabc<NL>defabc<NL>def" in Vim.In Command-line mode:<Esc> terminates the command-line without executing it. In vi the commandline would be executed, which is not what most people expect (hitting <Esc>should always get you back to command mode). To avoid problems with someobscure macros, an <Esc> in a macro will execute the command. If you want atyped <Esc> to execute the command like vi does you can fix this with ":cmap ^V<Esc> ^V<CR>"General:The 'ttimeout' option is like 'timeout', but only works for cursor andfunction keys, not for ordinary mapped characters. The 'timeoutlen' optiongives the number of milliseconds that is waited for. If the 'esckeys' optionis not set, cursor and function keys that start with <Esc> are not recognizedin insert mode.There is an option for each terminal string. Can be used when termcap is notsupported or to change individual strings.The 'fileformat' option can be set to select the <EOL>: "dos" <CR><NL>, "unix"<NL> or "mac" <CR>.When the 'fileformats' option is not empty, Vim tries to detect the type of<EOL> automatically. The 'fileformat' option is set accordingly.On systems that have no job control (older Unix systems and non-Unix systems)the CTRL-Z, ":stop" or ":suspend" command starts a new shell.If Vim is started on the Amiga without an interactive window for output, awindow is opened (and :sh still works). You can give a device to use forediting with the '-d' argument, e.g. "-d con:20/20/600/150".The 'columns' and 'lines' options are used to set or get the width and heightof the display.Option settings are read from the first and last few lines of the file.Option 'modelines' determines how many lines are tried (default is 5). Notethat this is different from the Vi versions that can execute any Ex commandin a modeline (a major security problem). |trojan-horse|If the 'insertmode' option is set (e.g. in .exrc), Vim starts in insert mode.And it comes back there, when pressing <Esc>.Undo information is kept in memory. Available memory limits the number andsize of change that can be undone. This may be a problem with MS-DOS, ishardly a problem on the Amiga and almost never with Unix and Win32.If the 'backup' or 'writebackup' option is set: Before a file is overwritten,a backup file (.bak) is made. If the "backup" option is set it is leftbehind.Vim creates a file ending in ".swp" to store parts of the file that have beenchanged or that do not fit in memory. This file can be used to recover froman aborted editing session with "vim -r file". Using the swap file can beswitched off by setting the 'updatecount' option to 0 or starting Vim withthe "-n" option. Use the 'directory' option for placing the .swp filesomewhere else.Vim is able to work correctly on filesystems with 8.3 file names, also whenusing messydos or crossdos filesystems on the Amiga, or any 8.3 mountedfilesystem under Unix. See |'shortname'|.Error messages are shown at least one second (Vi overwrites error messages).If Vim gives the |hit-return| prompt, you can hit any key. Characters otherthan <CR>, <NL> and <Space> are interpreted as the (start of) a command. (Vionly accepts a command starting with ':').The contents of the numbered and unnamed registers is remembered whenchanging files.The "No lines in buffer" message is a normal message instead of an errormessage, since that may cause a mapping to be aborted.The AUX: device of the Amiga is supported.==============================================================================6. Command-line arguments *cmdline-arguments*Different versions of Vi have different command-line arguments. This can beconfusing. To help you, this section gives an overview of the differences.Five variants of Vi will be considered here: Elvis Elvis version 2.1b Nvi Nvi version 1.79 Posix Posix 1003.2 Vi Vi version 3.7 (for Sun 4.1.x) Vile Vile version 7.4 (incomplete) Vim Vim version 5.2Only Vim is able to accept options in between and after the file names.+{command} Elvis, Nvi, Posix, Vi, Vim: Same as "-c {command}".- Nvi, Posix, Vi: Run Ex in batch mode. Vim: Read file from stdin (use -s for batch mode).-- Vim: End of options, only file names are following.--help Vim: show help message and exit.--version Vim: show version message and exit.-? Vile: print usage summary and exit.-a Elvis: Load all specified file names into a window (use -o for Vim).-b {blksize} Elvis: Use {blksize} blocksize for the session file.-b Vim: set 'binary' mode.-C Vim: Compatible mode.-c {command} Elvis, Nvi, Posix, Vim: run {command} as an Ex command after loading the edit buffer. Vim: allow up to 10 "-c" arguments-d {device} Vim: Use {device} for I/O (Amiga only).-e Elvis, Nvi, Vim: Start in Ex mode, as if the executable is called "ex".-f Vim: Run GUI in foreground (Amiga: don't open new window).-f {session} Elvis: Use {session} as the session file.-F Vim: Start in Farsi mode (when compiled with Farsi). Nvi: Fast start, don't read the entire file when editing starts.-G {gui} Elvis: Use the {gui} as user interface.-g Vim: Start GUI.-g N Vile: start editing at line N-h Vim: Give help message. Vile: edit the help file-H Vim: start Hebrew mode (when compiled with it).-i Elvis: Start each window in Insert mode.-i {viminfo} Vim: Use {viminfo} for viminfo file.-L Vim: Same as "-r" (also in some versions of Vi).-l Nvi, Vi, Vim: Set 'lisp' and 'showmatch' options.-m Vim: Modifications not allowed, reset 'write' option.-N Vim: No-compatible mode.-n Vim: No swap file used.-o[N] Vim: Open [N] windows, or one for each file.-q {name} Vim: Use {name} for quickfix error file.-q{name} Vim: Idem.-R Elvis, Nvi, Posix, Vile, Vim: Set the 'readonly' option.-r Elvis, Nvi, Posix, Vi, Vim: Recovery mode.-S Nvi: Set 'secure' option.-s Nvi, Posix, Vim: Same as "-" (silent mode), when in Ex mode. Elvis: Sets the 'safer' option.-s {scriptin} Vim: Read from script file {scriptin}; only when not in Ex mode.-s {pattern} Vile: search for {pattern}-t {tag} Elvis, Nvi, Posix, Vi, Vim: Edit the file containing {tag}.-t{tag} Vim: Idem.-T {term} Vim: Set terminal name to {term}.-u {vimrc} Vim: Read initializations from {vimrc} file.-U {gvimrc} Vim: Read GUI initializations from {gvimrc} file.-v Nvi, Posix, Vi, Vim: Begin in Normal mode (visual mode, in Vi terms). Vile: View mode, no changes possible.-V Elvis, Vim: Verbose mode.-w {size} Elvis, Posix, Nvi, Vi, Vim: Set value of 'window' to {size}.-w{size} Nvi, Vi: Same as "-w {size}".-w {name} Vim: Write to script file {name} (must start with non-digit).-W {name} Vim: Append to script file {name}.-x Vi, Vim: Ask for encryption key. See |encryption|.@{cmdfile} Vile: use {cmdfile} as startup file. vim:ts=8:sw=8:tw=78:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -