put `.vimrc` into the `.vim` folder
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Over a Mysterious Island
--
Chapters
00:00 Put `.Vimrc` Into The `.Vim` Folder
00:17 Accepted Answer Score 30
00:47 Answer 2 Score 16
01:05 Answer 3 Score 5
02:11 Answer 4 Score 2
02:23 Thank you
--
Full question
https://superuser.com/questions/438343/p...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#vim #vimrc
#avk47
ACCEPTED ANSWER
Score 30
Starting in Vim 7.4 you can also just place a file vimrc
into $HOME/.vim/vimrc
or $HOME/vimfiles/vimrc
for Windows and Vim will find it automatically.
Note, this is vimrc
without a . (dot) or _ (underscore) like the traditional .vimrc/_vimrc file would have.
ANSWER 2
Score 16
I keep my .vimrc in .vim and symlink it.
ln -s ~/.vim/.vimrc ~/.vimrc
On Windows I believe you can do the same with mklink.
ANSWER 3
Score 5
If you were to create an alias for vim to specify the location of the .vimrc like thus:
alias vim='vim -u ~/.vim/vimrc'
then you could do away with having .vimrc separate.
BUT
This will cause issues with other programs interacting with vim. Pressing 'v' in 'less' will not work, since it calls vim via the contents of the EDITOR env-variable. I suppose you could add the '-u ...' bit into the EDITOR variable. might work.
For gvim, you'd use an uppercase 'U' there, to specify the location of the .gvimrc file. Again, issues ensue unless you change EVERY possible starting location of gvim in your window manager's starting links.
All in all, I'd suggest using @remyo's suggestion if you MUST have it all in one subdir.
It's relatively easy to create a post-pull script that would reestablish the link between 'repo/.vimrc' and '~/.vimrc'.
Good luck.
(you could recompile vim yourself, specifying a new default location for the .vimrc file.)
ANSWER 4
Score 2
That's exactly what I do, with this single line in my ~/.vimrc
:
runtime vimrc