Windows – VIM destroys symbolic links under Windows

symbolic-linkvimwindows

It seems that when working with a file in VIM it primarily uses a backup version of the file then overwrites the original on save. This is a problem when using symbolic links under Windows (e.g. mklink link_path target_path) as it destroys the symbolic link.

Does anyone know a way around this? I've already seen this in the FAQ which talks specifically to this issue but the recommended workaround doesn't work. Maybe it did at some point but not for Vim 7.3 (under Windows 7 x64).

Best Answer

This bug was fixed in 7.3.1182. Vim 7.4 is the first release on vim.org to include this patch (released 2013-08-10).

To support older versions of vim, you can use something like this in your vimrc:

" Writing files on Windows doesn't preserve file attributes seen via cygwin
" (presumably because the created backup copy didn't inherit them correctly).
if has('win32') && v:version < 704
    set backupcopy=yes
endif
Related Question