up vote 2 down vote favorite
1
share [g+] share [fb]

I'm trying to keep my gVIM config in centralized place. For this, i have done

mklink c:\users\me\.vimrc c:\users\me\configs\_vimrc

That works fine until i change $MYVIMRC inside VIM. This instantly breaks symlink (c:\users\me.vimrc stop being a symlink and became ordinary file). Is it any way to fix this trange behavior? OS is Windows Vista with latest updates. gVIM is 7.2 from official site.

link|improve this question

feedback

2 Answers

up vote 3 down vote accepted

Vim is supposed to handle this correctly by default. (:help backupcopy)

By default, on non-unix platforms, backupcopy is set to "auto". It will normally rename the file and write a new changed file when you save, but should modify the original file if the original file is a link or has a resource fork, etc.

Several possibilities:

  1. Your version of vim does not recognize the file is a symlink.
  2. You've set backupcopy or a related variable (breaksymlink?) to override default behavior.

I'd be surprised if it's 1, since you're dealing with a recent version of vim. Does this happen if you have an empty .vimrc?

link|improve this answer
You are right, setting 'set backupcopy=yes' fixes problem on Vista+. Thanks! – Eye of Hell Oct 9 '09 at 7:08
Was backupcopy set to no before? auto is probably a better setting than yes, assuming it works in this case. – Captain Segfault Oct 9 '09 at 22:38
feedback

Try

mklink /J c:\users\me c:\users\me\configs

This will create a hardlink directory junction between c:\users\me and c:\users\me\configs that vista will respect when you rewrite you vimrc.

link|improve this answer
Have you tried this? The equivalent, in linux at least, would not work, because vim writes out a new file and copies it over when you save. – Captain Segfault Oct 8 '09 at 23:20
Oh, it's a directory link and not a file link, nevermind my previous comment. – Captain Segfault Oct 8 '09 at 23:23
Linking entire HOME folder is kind of... painful :) – Eye of Hell Oct 9 '09 at 4:11
Consider it to be the... Spleen of Hell ;-) – DaveParillo Oct 10 '09 at 0:06
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.