Thursday, October 10, 2013

Re: Vimdiff, version 7.4 on Windows 7

After installing vim 7.4 on Windows XP, I got the exact same errors as the OP when trying to do diffsplit:

E810: Cannot read or write temp files
E97: Cannot create diffs

FIX (that worked for me):
In MyDiff() of _vimrc, go to line 13 and change the two single quotes to double quotes. This allows the pattern in the IF-test to match.

So change:
if &sh =~ '\<cmd' (fails)

To:
if &sh =~ "\<cmd" (works)

Or keep single quotes but escape the backslash:
if &sh =~ '\\<cmd' (also works)

Oddly, the original line is technically correct. It seems like there is a bug in vim 7.4 that is swapping the meaning of single and double quotes here.


1 function MyDiff()
2 let opt = '-a --binary '
3 if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
4 if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
5 let arg1 = v:fname_in
6 if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
7 let arg2 = v:fname_new
8 if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
9 let arg3 = v:fname_out
10 if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
11 let eq = ''
12 if $VIMRUNTIME =~ ' '
13>>> if &sh =~ '\<cmd' <<<--- CHANGE TO DOUBLE QUOTES
14 let cmd = '""' . $VIMRUNTIME . '\diff"'
15 let eq = '"'
16 else
17 let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
18 endif
19 else
20 let cmd = $VIMRUNTIME . '\diff'
21 endif
22 silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
23 endfunction

(Credit to fvelasqu...@gmail.com, http://code.google.com/p/vim/issues/detail?id=28#c6)

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: