Reputation: 4740
I have a repository of my home config files - http://hg.jackleo.info/home-configs
I noticed that my vim configuration is getting bigger and bigger (90% of commits is only related to vim) so I want to trow it to separate repository.
The problem is that since i'm using home-config repository at my actual home folder vimrc file is also in same place. If I would include subrepo to Vim configuration (folder .vim) I couldn't commit .vimrc file to that sub-repository.
Is there a way to simply write import file_path_to_other_config
and hold exact configuration in .vim folder?
Upvotes: 17
Views: 11385
Reputation: 34626
I had a similar thought some while ago and came up with quite a simple solution. I have a ~/.vim/Makefile
which reads like this:
$(HOME)/.vimrc: Makefile vimrc.tmpl
@cat vimrc.tmpl | sed 's\@@HOME@@\$(HOME)\g' > $(HOME)/.vimrc
With .vim/vimrc.tmpl
being:
let $VIM = '@@HOME@@/.vim'
let $VIMRC = $VIM.'/custom.vimrc'
if filereadable($VIMRC)
source $VIMRC
endif
I have everything in an extra git repository and when I work in a new system, I only have to clone the repository and call make
inside ~/.vim
.
Upvotes: 0
Reputation: 291
You could use the source command in your vimrc:
source file_path_to_other_config
Here is the vim help page on source: http://vimdoc.sourceforge.net/htmldoc/repeat.html#:source
Upvotes: 25