简体   繁体   中英

Install multiple version of Vim, and make each use different .vimrc file, respectively

Make it on Linux. The reason to use more than one version of Vim, is because one version would be heavily hacked, for Lisp jobs. I want separate it and make it use it's own .vimrc file as well.

/usr/bin/vim   use -> ~/.vimrc
/my/vim        use -> ..../another_vimrc

Command line option

You can give the -u parameter to your command line. This parameter will force the vim to read the specific vimrc without reading the system wide configurations:

/my/vim -u /path/another_vimrc

You can even create a command alias, with which you can start this custom vim. Put this in your .bash_profile for eg:

alias customvim /my/vim -u /path/another_vimrc

And then start this custom vim with:

customvim

Building configuration

You can specify the prefix option to the configuration script of when you're building from source. If you set this, vim will look for configuration file in the prefixed directory.

For eg if you do with stow :

./configure --prefix=/usr/local/stow/vim-7.3/ && make install

Then the vim will be installed in /usr/local/stow/vim-7.3/ and the custom configuration should be in /usr/local/stow/vim-7.3/etc/vimrc

You can use the Predefined Vim variables(v:version) .
Suppose you have installed both vim6 and vim7 , you can create two .vimrc_X files:

~/.vimrc_6
~/.vimrc_7

Then you create another .vimrc file:

~/.vimrc

which contains:

if v:version >=700
    source ~/.vimrc_7
elseif v:version >=600
    source ~/.vimrc_6
endif

看看Vim filetype插件(搜索ftplugin),它允许您为给定的文件类型指定配置。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM