如何使git difftool使用gvim(gvimdiff)? [英] How can I make git difftool to use gvim (gvimdiff)?

查看:611
本文介绍了如何使git difftool使用gvim(gvimdiff)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎git发生了变化,这使得它不能再与gvim作为diff工具一起正常工作.具体来说,我一直使用gvim -geometry标志来最大化窗口.现在,我最后得到一个空白窗口(空/零行文件).

There seems to have been a change in git which makes it no longer work correctly with gvim as the diff tool. Specifically, I always used to use the gvim -geometry flag to maximize the window. Now, I end up with one of the windows blank (empty/zero line file).

推荐答案

好的,我找到了答案.为了正常工作,gvim必须留在前台并且不要像往常一样派生新进程.这是通过在启动gvim(或gvimdiff)时使用"-f"或"--nofork"标志来实现的.

OK, I found the answer. In order to work correctly, gvim must stay in the foreground and NOT fork a new process as usual. This is accomplished by using the "-f" or "--nofork" flag when starting gvim (or gvimdiff).

我现在设置了以下有效的别名:

I have now setup the following alias which works:

alias gitdg ='git difftool --noprompt --extcmd ="gvim -d --nofork -geometry 220x80 + 2000 + 40"'

alias gitdg='git difftool --noprompt --extcmd="gvim -d --nofork -geometry 220x80+2000+40" '

请小心注意单引号与双引号的位置,以保持zsh shell满意.

Please be careful to note the placement of single- vs. double-quotes to keep the zsh shell happy.

我使用gvim选项"-geometry"将差异窗口配置为具有220行x 80列. "+ 2000 + 40"表示窗口的左上角相对于所有监视器的左上角水平偏移2000像素,垂直偏移80像素,因此该窗口出现在我的2监视器设置的右侧监视器上.尝试将其设置为"-geometry 160x40 + 60 + 20",以查看更改的效果.

I used the gvim option "-geometry" to configure the diff windows to have 220 lines x 80 columns. The "+2000+40" means the upperleft corner of window to be offset of 2000 pixels horizontally and 80 pixels vertically from the top-left corner of all monitors, so the window appears on the right monitor of my 2-monitor setup. Try setting it to "-geometry 160x40+60+20" to see the effect of changes.

这篇关于如何使git difftool使用gvim(gvimdiff)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆