Symlink to .vimrc on windows makes file readonly upon write. Why?

I've put my .vimrc file in a central location (dropbox folder, also a hg repository).

Under Windows 7, I've symlinked to it from my home folder (strangely enough I had to do it as an administrator, otherwise I got 'no permission'):

C:\users\Me>mklink .vimrc C:\users\me\dropbox\dotfiles\.vimrc

After fixing an overwrite issue by using set backupcopy=yes (found here: gVIM breaks symlinks on windows?), I have another issue. When I save the modified file, the real .vimrc (in my dropbox/dotfiles folder) gets a read-only flag as soon as I save it (using :w).

Why is this? How can I prevent this?


Solution 1:

I can propose another way of solving symlink issue, which I use on Windows XP machines or on Windows 7 without administrative rights.

Create _vimrc file with one line

source /path/to/real/vimrc

and update $MYVIMRC variable in your real vimrc file, e.g.

let $MYVIMRC='/path/to/real/vimrc'

Changing value of $MYVIMRC is useful for referring to correct vimrc file (for example in autocommands that reread it) on different systems.