How do I “source” something in my .vimrc file?

后端 未结 4 2035
孤独总比滥情好
孤独总比滥情好 2021-01-30 00:39

I\'ve been working on expanding my vim-foo lately and I\'ve run across a couple of plugins (autotag.vim for example) that require them to be \"sourced\" in my .vimrc file. What

4条回答
  •  太阳男子
    2021-01-30 01:00

    There are normally two vimrc files, one is _vimrc and the other _gvimrc (in the first one are the things for vim, and in the second for gvim - graphical things) - although most people I know just put everything in _vimrc.

    A good practice is to keep all your extra files (plugins, colorschemes, snippets ...) in a separate (your own) vimfiles directory (which you can take with you).

    If you do

    :help vimfiles
    

    vim will tell your vimfiles directory should be located. It depends somewhat on the platform (win, unix). On windows the usual is in your user folder (documents and settings, then user ...). In vimfiles directory there are a couple of subdirectories. Amongst them is the "plugin" subdirectory. Plugins put in that dir will be loaded automatically (also plugins put in subdirectories of "plugin"). If you do not wish to load it automatically, just put it in your "vimfiles", or some other directory, and

    :so plugin_name.vim (with the appropriate path)
    (you can use the $vim, $vimfiles, and $home as shortcuts when defining path to plugin)
    

提交回复
热议问题