Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Putting .vimrc in vimfiles directory

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?

like image 725
Alexey Romanov Avatar asked Oct 10 '10 07:10

Alexey Romanov


2 Answers

Just put a dummy .vimrc in ~ with just a single line:

source ~/path/to/real/vimrc  

Works like a charm

like image 166
Mark Avatar answered Oct 11 '22 10:10

Mark


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.

like image 39
mike3996 Avatar answered Oct 11 '22 10:10

mike3996