1

My customized _vimrc file is saved at $HOME which is here:

M:_vimrc

Could I move _vimrc to say the following location and still have gvim find it ok?

M:\UsefulDirectoryName_vimrc

Sagar Jain
  • 7,475
  • 12
  • 47
  • 83
whytheq
  • 34,466
  • 65
  • 172
  • 267
  • Yes you can :) This question answers the question for you: http://stackoverflow.com/questions/7109667/change-default-location-of-vimrc – CodeTower May 16 '13 at 13:21

2 Answers2

3

:help vimrc says

    Recommended place for your personal initializations:
    Unix            $HOME/.vimrc
    OS/2            $HOME/.vimrc or $VIM/.vimrc (or _vimrc)
    MS-DOS and Win32    $HOME/_vimrc or $VIM/_vimrc
    Amiga           s:.vimrc or $VIM/.vimrc

So, you can set $VIM to UsefulDirectoryName and give it a try.

tuxcanfly
  • 2,494
  • 1
  • 20
  • 18
3

Vim will only find your _vimrc if it's at one of these two locations:

$HOME/_vimrc
$VIM/_vimrc

If you want to use a different location you'll have to tell Vim where your _vimrc is. You can:

  • launch Vim with this command, vim -u /path/to/_vimrc
  • add this line to $HOME/_vimrc, source /path/to/_vimrc
romainl
  • 186,200
  • 21
  • 280
  • 313
  • romainl - you are the omnipresent vimmer - +1 thanks – whytheq May 16 '13 at 14:37
  • 2
    `:s/omnipresent/bored` – romainl May 16 '13 at 14:40
  • but if I use your method I will still need to keep `$HOME/_vimrc` but it will only have one line in it `source /path/to/_vimrc` and the actual rc that does all the work will be at `/path/to/_vimrc` ? – whytheq May 16 '13 at 14:45
  • 1
    Yes. That's basically what I do to keep my `~/.vim` directory under version control with my "real" vimrc inside. – romainl May 16 '13 at 14:48
  • @romainl don't shake my beliefs you are omnipresent! – Peter Rincker May 16 '13 at 15:15
  • @PeterRincker ...try it out; type a request for vim into SO and he appears - like a hotline to romainl - starting to think his name might be Bram – whytheq May 16 '13 at 15:34
  • When I learned of the #vim IRC channel earlier this year, I headed into my client to check it out, and the first message that popped up was romainl. He *is* omnipresent. – Gary Fixler May 16 '13 at 23:46
  • Incidentally, I also learned about #vim not long ago. And no, I'm not Bram, far from it. – romainl May 17 '13 at 04:53
  • @romainl omnipresent(ish) ...[this has been left alone](http://stackoverflow.com/questions/16802259/vim-not-finding-the-end-of-the-sql-statement) – whytheq May 29 '13 at 21:02