Jay
Jay

Reputation: 9602

How do I launch WinMerge from Vim?

On my Mac, I use this to diff my current buffer:

nnoremap <Space>d
\   :silent w! /tmp/vim_current_buffer<cr>
\   :silent !gdiff "%" /tmp/vim_current_buffer<cr>

(gdiff is my graphical differ)

Now I'm using Windows 7, and I'm trying to get this code to work with WinMerge. But, I can't figure-out how to launch WinMerge from the command line.


Update

I can run WinMerge with:

nnoremap <Space>m :!"C:\Program Files (x86)\WinMerge\WinMergeU.exe"<cr>

But I can't get it to open two files. Adding the extra slashes doesn't work. I get this when I try it:

C:\Windows\system32\cmd.exe /c C:\\Program\ Files\ (x86)\\WinMerge\\WinMergeU.ex
e
'C:\\Program\' is not recognized as an internal or external command,
operable program or batch file.
shell returned 1
Hit any key to close this window...

This is what I have so far:

nnoremap <Space>d
\   :silent w! "C:\tmp\vim_current_buffer"<cr>
\   :silent !"C:\Program Files (x86)\WinMerge\WinMergeU.exe" "C:\tmp\vim_current_buffer" "%" <cr>

Is there anyone to see the error?

Upvotes: 0

Views: 596

Answers (1)

echristopherson
echristopherson

Reputation: 7074

Do you know the path to WinMerge's executable? It would be something like C:\Program Files\WinMerge\WinMergeU.exe. You should be able to put that in instead of gdiff, but put a backslash before each original backslash and space in the name (e.g. C:\\Program\ Files\\WinMerge\\WinMergeU.exe).

Upvotes: 1

Related Questions