vimdiff E97 in Powershell

时光怂恿深爱的人放手 提交于 2019-12-05 10:36:58

The problem boils down to how vim/Powershell are A) encapsulating the command in quotes and B) handling white space in path names.

I am able to bypass this problem with the following changes to $myvimrc:

set shell=powershell
set shellcmdflag=-c
set shellquote="
set shellxquote=

Also a change in the default MyDiff() function within the if that sets the path to diff in the cmd variable:

  " below is the default
  " let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
  let cmd = "C:/diff"

This approach is dependent upon copying the diff.exe that ships with vim to a directory that doesn't contain spaces in the path for simplicity (C:\diff.exe).

The resulting command that is executed is:

powershell -c C:/diff -a --binary C:/<redacted>/a.tmp C:/<redacted>/b.tmp > C:/<redacted>/c.tmp
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!