2014-09-03 2 views
0

나는 vim을 오랫동안 사용해 왔으며 Vbundle을 사용하여 플러그인을 관리하고 있습니다. vimrc의 시작 프로세스 (언제 .vimrc 또는 스크립트가 자동로드되고 플러그인이 소스로되어 있는지 궁금합니다.)에 아이디어가 있습니까?VIM의 시작 프로세스는 무엇입니까?

답변

1

초기화 프로세스는 Vim 자체 내에서 문서화됩니다. 사용자가 다음을 입력하는 경우,

:help 

을 빔으로, 당신에게 준수 프로세스를 보여줍니다, initialization 다음 starting.txt을 선택합니다.

그것은 심장 약한 아니다, 여기에 내 데비안에서 관련 비트 설치의 : vimlog에서



At startup, Vim checks environment variables and files and sets values 
accordingly. Vim proceeds in this order: 

1. Set the 'shell' and 'term' option  *SHELL* *COMSPEC* *TERM* 
    The environment variable SHELL, if it exists, is used to set the 
    'shell' option. On MS-DOS and Win32, the COMSPEC variable is used 
    if SHELL is not set. 
    The environment variable TERM, if it exists, is used to set the 'term' 
    option. However, 'term' will change later when starting the GUI (step 
    8 below). 

2. Process the arguments 
    The options and file names from the command that start Vim are 
    inspected. Buffers are created for all files (but not loaded yet). 
    The |-V| argument can be used to display or log what happens next, 
    useful for debugging the initializations. 

3. Execute Ex commands, from environment variables and/or files 
    An environment variable is read as one Ex command line, where multiple 
    commands must be separated with '|' or "". 
           *vimrc* *exrc* 
    A file that contains initialization commands is called a "vimrc" file. 
    Each line in a vimrc file is executed as an Ex command line. It is 
    sometimes also referred to as "exrc" file. They are the same type of 
    file, but "exrc" is what Vi always used, "vimrc" is a Vim specific 
    name. Also see |vimrc-intro|. 

    Recommended place for your personal initializations: 
     Unix   $HOME/.vimrc 
     OS/2   $HOME/.vimrc or $VIM/.vimrc (or _vimrc) 
     MS-DOS and Win32 $HOME/_vimrc or $VIM/_vimrc 
     Amiga   s:.vimrc or $VIM/.vimrc 

    If Vim was started with "-u filename", the file "filename" is used. 
    All following initializations until 4. are skipped. 
    "vim -u NORC" can be used to skip these initializations without 
    reading a file. "vim -u NONE" also skips loading plugins. |-u| 

    If Vim was started in Ex mode with the "-s" argument, all following 
    initializations until 4. are skipped. Only the "-u" option is 
    interpreted. 
          *evim.vim* 
    a. If vim was started as |evim| or |eview| or with the |-y| argument, 
    the script $VIMRUNTIME/evim.vim will be loaded. 
          *system-vimrc* 
    b. For Unix, MS-DOS, MS-Windows, OS/2, VMS, Macintosh, RISC-OS and Amiga 
    the system vimrc file is read for initializations. The path of this 
    file is shown with the ":version" command. Mostly it's "$VIM/vimrc". 
    Note that this file is ALWAYS read in 'compatible' mode, since the 
    automatic resetting of 'compatible' is only done later. Add a ":set 
    nocp" command if you like. 
    For the Macintosh the $VIMRUNTIME/macmap.vim is read. 

     *VIMINIT* *.vimrc* *_vimrc* *EXINIT* *.exrc* *_exrc* *$MYVIMRC* 
    c. Four places are searched for initializations. The first that exists 
    is used, the others are ignored. The $MYVIMRC environment variable is 
    set to the file that was first found, unless $MYVIMRC was already set 
    and when using VIMINIT. 
    - The environment variable VIMINIT (see also |compatible-default|) (*) 
     The value of $VIMINIT is used as an Ex command line. 
    - The user vimrc file(s): 
      "$HOME/.vimrc" (for Unix and OS/2) (*) 
      "s:.vimrc"  (for Amiga) (*) 
      "home:.vimrc" (for Amiga) (*) 
      "$VIM/.vimrc" (for OS/2 and Amiga) (*) 
      "$HOME/_vimrc" (for MS-DOS and Win32) (*) 
      "$VIM/_vimrc" (for MS-DOS and Win32) (*) 
     Note: For Unix, OS/2 and Amiga, when ".vimrc" does not exist, 
     "_vimrc" is also tried, in case an MS-DOS compatible file 
     system is used. For MS-DOS and Win32 ".vimrc" is checked 
     after "_vimrc", in case long file names are used. 
     Note: For MS-DOS and Win32, "$HOME" is checked first. If no 
     "_vimrc" or ".vimrc" is found there, "$VIM" is tried. 
     See |$VIM| for when $VIM is not set. 
    - The environment variable EXINIT. 
     The value of $EXINIT is used as an Ex command line. 
    - The user exrc file(s). Same as for the user vimrc file, but with 
     "vimrc" replaced by "exrc". But only one of ".exrc" and "_exrc" is 
     used, depending on the system. And without the (*)! 

    d. If the 'exrc' option is on (which is not the default), the current 
    directory is searched for three files. The first that exists is used, 
    the others are ignored. 
    - The file ".vimrc" (for Unix, Amiga and OS/2) (*) 
      "_vimrc" (for MS-DOS and Win32) (*) 
    - The file "_vimrc" (for Unix, Amiga and OS/2) (*) 
      ".vimrc" (for MS-DOS and Win32) (*) 
    - The file ".exrc" (for Unix, Amiga and OS/2) 
      "_exrc" (for MS-DOS and Win32) 

    (*) Using this file or environment variable will cause 'compatible' to 
    be off by default. See |compatible-default|. 

4. Load the plugin scripts.     *load-plugins* 
    This does the same as the command: 
     :runtime! plugin/**/*.vim 
    The result is that all directories in the 'runtimepath' option will be 
    searched for the "plugin" sub-directory and all files ending in ".vim" 
    will be sourced (in alphabetical order per directory), also in 
    subdirectories. 
    Loading plugins won't be done when: 
    - The 'loadplugins' option was reset in a vimrc file. 
    - The |--noplugin| command line argument is used. 
    - The "-u NONE" command line argument is used |-u|. 
    - When Vim was compiled without the |+eval| feature. 
    Note that using "-c 'set noloadplugins'" doesn't work, because the 
    commands from the command line have not been executed yet. You can 
    use "--cmd 'set noloadplugins'" |--cmd|. 

5. Set 'shellpipe' and 'shellredir' 
    The 'shellpipe' and 'shellredir' options are set according to the 
    value of the 'shell' option, unless they have been set before. 
    This means that Vim will figure out the values of 'shellpipe' and 
    'shellredir' for you, unless you have set them yourself. 

6. Set 'updatecount' to zero, if "-n" command argument used 

7. Set binary options 
    If the "-b" flag was given to Vim, the options for binary editing will 
    be set now. See |-b|. 

8. Perform GUI initializations 
    Only when starting "gvim", the GUI initializations will be done. See 
    |gui-init|. 

9. Read the viminfo file 
    If the 'viminfo' option is not empty, the viminfo file is read. See 
    |viminfo-file|. 

10. Read the quickfix file 
    If the "-q" flag was given to Vim, the quickfix file is read. If this 
    fails, Vim exits. 

11. Open all windows 
    When the |-o| flag was given, windows will be opened (but not 
    displayed yet). 
    When the |-p| flag was given, tab pages will be created (but not 
    displayed yet). 
    When switching screens, it happens now. Redrawing starts. 
    If the "-q" flag was given to Vim, the first error is jumped to. 
    Buffers for all windows will be loaded. 

12. Execute startup commands 
    If a "-t" flag was given to Vim, the tag is jumped to. 
    The commands given with the |-c| and |+cmd| arguments are executed. 
    The starting flag is reset, has("vim_starting") will now return zero. 
    If the 'insertmode' option is set, Insert mode is entered. 
    The |VimEnter| autocommands are executed. 
2
vim --startuptime vimlog 

, 그것은 각각의 프로세스 및 플러그인 비용 시간을 알려줍니다.