?? starting.txt
字號:
*starting.txt* For Vim version 5.8. Last change: 2000 Nov 16 VIM REFERENCE MANUAL by Bram MoolenaarStarting Vim *starting*1. Vim arguments |vim-arguments|2. Vim on the Amiga |starting-amiga|3. Running Vim from xargs |xargs|4. Initialization |initialization|5. Suspending |suspend|6. The vimrc file |vimrc-intro|7. The viminfo file |viminfo-file|==============================================================================1. Vim arguments *vim-arguments*Most often, Vim is started to edit a single file with the command vim filename *-vim*More generally, Vim is started with: vim [option | filename] ..Option arguments and file name arguments can be mixed, and any number of themcan be given. However, watch out for options that take an argument.For compatibility with various Vi versions, see |cmdline-arguments|.Exactly one out of the following five items may be used to choose how tostart editing: *-file* *---*filename One or more file names. The first one will be the current file and read into the buffer. The cursor will be positioned on the first line of the buffer. To avoid a file name starting with a '-' being interpreted as an option, precede the arglist with "--", e.g.: Vim -- -filename All arguments after the "--" will be interpreted as file names, no other options or "+command" argument can follow. *--*- This argument can mean two things, depending on whether Ex mode is to be used. Starting in Normal mode:> vim - or ex -v - Start editing a new buffer, which is filled with text that is read from stdin. The commands that would normally be read from stdin will now be read from stderr. Example:> find . -name "*.c" -print | vim - The buffer will be marked modified, because it contains text that needs to be saved. Except when in readonly mode, then the buffer is not marked modified. Example:> ls | view - Starting in Ex mode:> ex - or vim -e - Start editing in silent mode. See |-s-ex|. *-t* *-tag*-t {tag} A tag. "tag" is looked up in the tags file, the associated file becomes the current file, and the associated command is executed. Mostly this is used for C programs, in which case "tag" often is a function name. The effect is that the file containing that function becomes the current file and the cursor is positioned on the start of the function (see |tags|). *-q* *-qf*-q [errorfile] QuickFix mode. The file with the name [errorfile] is read and the first error is displayed. See |quickfix|. If [errorfile] is not given, the 'errorfile' option is used for the file name. See 'errorfile' for the default value. {not in Vi}(nothing) Without one of the four items above, Vim will start editing a new buffer. It's empty and doesn't have a file name.The startup mode can be changed by using another name instead of "vim", whichis equal to giving options:ex vim -e Start in Ex mode (see |Ex-mode|). *ex*view vim -R Start in read-only mode (see |-R|). *view*gvim vim -g Start the GUI (see |gui|). *gvim*gex vim -eg Start the GUI in Ex mode. *gex*gview vim -Rg Start the GUI in read-only mode. *gview*rvim vim -Z Like "vim", but in restricted mode (see |-Z|) *rvim*rview vim -RZ Like "view", but in restricted mode. *rview*rgvim vim -gZ Like "gvim", but in restricted mode. *rgvim*rgview vim -RgZ Like "gview", but in restricted mode. *rgview*Additional characters may follow, they are ignored. For example, you can have"gvim-5" to start the GUI. You must have an executable by that name then, ofcourse.On Unix, you would normally have one executable called Vim, and links from thedifferent startup-names to that executable. If your system does not supportlinks and you do not want to have several copies of the executable, you coulduse an alias instead. For example:> alias view vim -R> alias gvim vim -g *startup-options*The option arguments may be given in any order. Single-letter options can becombined after one dash. There can be no option arguments after the "--"argument.--help *-h* *--help*-h Give usage (help) message and exit. {not in Vi} *--version*--version Print version information and exit. Same output as for |:version| command. {not in Vi} *-+*+[num] The cursor will be positioned on line "num" for the first file being edited. If "num" is missing, the cursor will be positioned on the last line. *-+/*+/{pat} The cursor will be positioned on the first line containing "pat" in the first file being edited (see |pattern| for the available search patterns).+{command} *-+c* *-c*-c {command} "command" will be executed after the first file has been read (and after autocommands and modelines for that file have been processed). "command" is interpreted as an Ex command. If the "command" contains spaces, it must be enclosed in double quotes (this depends on the shell that is used). Example:> vim "+set si" main.c> vim -c "set ff=dos" -c wq mine.mak Note: You can use up to 10 "+" or "-c" arguments in a Vim command. They are executed in the order given. {Vi only allows one command} *-r*-r Recovery mode. Without a file name argument, a list of existing swap files is given. With a file name, a swap file is read to recover a crashed editing session. See |crash-recovery|. *-L*-L Same as -r. {only in some versions of Vi: "List recoverable edit sessions"} *-R*-R Readonly mode. The 'readonly' option will be set for all the files being edited. You can still edit the buffer, but will be prevented from accidentally overwriting a file. If you forgot that you are in View mode and did make some changes, you can overwrite a file by adding an exclamation mark to the Ex command, as in ":w!". The 'readonly' option can be reset with ":set noro" (see the options chapter, |options|). Subsequent edits will not be done in readonly mode. Calling the executable "view" has the same effect as the -R argument. The 'updatecount' option will be set to 10000, meaning that the swap file will not be updated automatically very often. *-m*-m Modifications not allowed. The 'write' option will be reset, so that writing files is disabled. The 'write' option can be set to enable writing again. *-Z* *restricted-mode*-Z Restricted mode. All commands that make use of an external shell are disabled. This includes suspending with CTRL-Z, ":sh", filtering, the system() function, backtick expansion, etc. *-g*-g Start Vim in GUI mode. See |gui|. *-v*-v Start Ex in Vi mode. Only makes a difference when the executable is called "ex" or "gvim". For gvim the GUI is not started if possible. *-e*-e Start Vim in Ex mode. Only makes a difference when the executable is not called "ex". *-s-ex*-s Silent or batch mode. Only when Vim was started as "ex" or when preceded with the "-e" argument. Otherwise see |-s|. To be used when Vim is used to execute Ex commands from a file instead of a terminal. Switches off most prompts and informative messages. But not warning and error messages, and the output from commands that print text lines, like ":print" and ":list". Initializations are skipped (except the ones given with the "-u" argument). *-b*-b Binary mode. File I/O will only recognize <NL> to separate lines. The 'expandtab' option will be reset. The 'textwidth' option is set to 0. 'modeline' is reset. The 'binary' option is set. This is done after reading the vimrc/exrc files but before reading any file in the arglist. See also |edit-binary|. {not in Vi} *-l*-l Lisp mode. Sets the 'lisp' and 'showmatch' options on. *-F*-F Farsi mode. Sets the 'fkmap' and 'rightleft' options on. (Only when compiled with |+rightleft| and |+farsi| features, otherwise Vim gives an error message and exits). {not in Vi} *-H*-H Hebrew mode. Sets the 'hkmap' and 'rightleft' options on. (Only when compiled with the |+rightleft| feature, otherwise Vim gives an error message and exits). {not in Vi} *-V* *verbose*-V[n] Verbose. Sets the 'verbose' option to [n][ (default: 10). Messages will be given for each file that is ":source"d and for reading or writing a viminfo file. Can be used to find out what is happening upon startup and exit. {not in Vi} *-C*-C Compatible mode. Sets the 'compatible' option. You can use this to get 'compatible', even though there is a .vimrc file. Also see |compatible-default|. {not in Vi} *-N*-N Not compatible mode. Resets the 'compatible' option. You can use this to get 'nocompatible', when there is no .vimrc file. Also see |compatible-default|. {not in Vi} *-n*-n No swap file will be used. Recovery after a crash will be impossible. Handy if you want to view or edit a file on a very slow medium (e.g., a floppy). Can also be done with ":set updatecount=0". You can switch it on again by setting the 'updatecount' option to some value, e.g., ":set uc=100". 'updatecount' is set to 0 AFTER executing commands from a vimrc file, but before the GUI initializations. Thus it overrides a setting for 'updatecount' in a vimrc file, but not in a gvimrc file. See |startup|. {not in Vi} When you want to reduce accesses to the disk (e.g., for a laptop), don't use "-n", but set 'updatetime' and 'udpatecount' to very big numbers, and type ":preserve" when you want to save your work. This way you keep the possibility for crash recovery. *-o*-o[N] Open N windows. If [N] is not given, one window is opened for every file given as argument. If there is not enough room, only the first few files get a window. If there are more windows than arguments, the last few windows will be editing an empty file. {not in Vi} *-T*-T {terminal} Set the terminal type to "terminal". This influences the codes that Vim will send to your terminal. This is normally not needed, because Vim will be able to find out what type of terminal you are using (See |terminal-info|). {not in Vi} *-d*-d {device} Amiga only: The "device" is opened to be used for editing. Normally you would use this to set the window position and size: "-d con:x/y/width/height", e.g., "-d con:30/10/600/150". But you can also use it to start editing on another device, e.g., AUX:. {not in Vi} *-f*-f Amiga: Do not restart Vim to open a new window. This option should be used when Vim is started by a program that will wait for the edit session to finish (e.g., mail or readnews). See |amiga-window|. {not in Vi} GUI: Do not disconnect from the program that started Vim. 'f' stands for "foreground". If omitted, the GUI forks a new process and exits the current one. "-f" should be used when gvim is started by a program that will wait for the edit session to finish (e.g., mail or readnews). If you want gvim never to fork, include 'f' in 'guioptions' in your .gvimrc. Careful: You can use "-gf" to start the GUI in the foreground, but "-fg" is used to specify the foreground color. {not in Vi} |gui-fork| *-u*-u {vimrc} The file "vimrc" is read for initializations. Other initializations are skipped; see |initialization|. This can be used to start Vim in a special mode, with special mappings and settings. A shell alias can be used to make this easy to use. For example:> alias vimc vim -u ~/.c_vimrc !*
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -