I want to keep my Vim and Emacs configurations under version control, but I don't want my entire home folder there (or rather, I do, but there should be 3 separate repositories). With Emacs it's easy; if ~/.emacs
doesn't exist, then ~/.emacs.d/init.el
is used as the init file. So I can have a separate Git repo in ~/.emacs.d/
. With Vim, it seems .vimrc
can only exist in home folder and not in ~/vimfiles
(the equivalent to ~/.emacs.d
). Is this the best way to put .vimrc
under version control?
views:
36answers:
2
+1
A:
You could just keep a backup in version control and deploy it (i.e. move it) to your home directory when you need it. You could write an easy script to manage all this handling so at least transparently it won't seem like a lot of annoying work to move it back and forth.
tandu
2010-10-10 07:53:11
+1
A:
Perhaps moving your .vimrc
to ~/.vim/
and symlinking to home will do?
Other, much more modular approach is to move your startup script to ~/.vim/plugins/
, perhaps create a subdirectory there, and single or multiple init scripts: Vim will do a :runtime! plugin/**/*.vim
when starting.
progo
2010-10-10 08:48:19
Your second suggestion is _precisely_ what I was asking about.
Alexey Romanov
2010-10-10 09:53:36
As it happened, I was forced to use the `runtime vimrc` approach after all, to ensure that my startup script is loaded first and loads Pathogen _before_ Vim gets the chance to do `:runtime! plugin/**/*.vim`.
Alexey Romanov
2010-10-10 19:23:43
Oh, these kinds of special conditions may indeed invalidate otherwise such a nice technique. Have you read `:help starting.txt` for additional tips? The files are sourced in alphabetical order, so renaming your startup script to `00_startup.vim` could work?
progo
2010-10-11 09:15:28