Wikia

Vim Tips Wiki

Use (and maintain) a single set of configuration files

Talk0
1,613pages on
this wiki
Revision as of 03:49, July 18, 2013 by Gennaro.prota (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

To share your vimrc file between all of your systems and environments, you have at least a couple of options.

Option 1 (use the :source command)

By using the :source command, you can put your vimrc file and all its dependencies in a common directory (preferably under version control) and source those common files from each vimrc that needs them. In fact, you'll very likely just source one of them (the "main" one) and that will, in turn, source others.

For instance, the vimrc file in your Windows home will look something like:

source X:/path/to/common/dot-files/vim/my_vim.vim

For other systems, you'd have the moral equivalent of the above, using the system's file naming conventions (Note: Cygwin, in particular, may have problems with DOS-style paths, so you are probably better off with Option 2, below).

Option 2 (symbolic link)

Once you have the common files available somewhere you can make each .vimrc that you need be actually a symbolic link to the common .vimrc "main" file (see above). Under Unix and Cygwin:

$ cd ~
$ ln -s /path/to/common/dot-files/vim/my_vim.vim .vimrc

Do not forget that you can use has() and exists() to cope with the different capabilities offered by the various Vim builds and distributions.

Around Wikia's network

Random Wiki