将Vimdiff用作Git Difftool时列出文件对

发布于 2025-02-04 17:36:58 字数 954 浏览 4 评论 0原文

git difftool进行比较时,我正在使用vimdiff作为工具。

我想将2个提交与git difftool< commit1&gt进行比较。 < commit2>。 今天,我必须使用:QA退出每个Vimdiff视图,才能到达下一个文件对。 有时,通过这种类型的比较,文件对列表可能很大。然后,我必须键入:QA数十个次(或:CQ完成后)。

有没有一种方法可以在QuickFix位置列表或类似的内容中显示所有比较文件对(至少有1个更改)?

,然后,然后获得概述并滚动浏览所有更改并仅显示所选文件的差异将更容易。


我的.gitConfig的提取:

[diff]
    tool = vimdiff
[difftool]
    prompt = false
    # Be able to abort all diffs with `:cq` or `:cquit`
    trustExitCode = true

vimdiff - version

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 18 2022 19:26:30)
Included patches: 1-3995

git-version

git version 2.34.1

I'm using vimdiff as tool when comparing with git difftool.

I want to compare 2 commits with git difftool <commit1> <commit2>.
Today, I have to exit every vimdiff view with :qa to get to the next file pair.
Sometimes, the list of file pairs can be huge with this type of comparison. Then, I have to type :qa dozens of times (or :cq when done).

Is there a way to display all compared file pairs (with at least 1 change) in a QuickFix, Location List or something similar?

Then, it would be must easier to get an overview and to scroll through all changes and show only the diff of selected files.


Extract of my .gitconfig:

[diff]
    tool = vimdiff
[difftool]
    prompt = false
    # Be able to abort all diffs with `:cq` or `:cquit`
    trustExitCode = true

vimdiff --version:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 18 2022 19:26:30)
Included patches: 1-3995

git --version:

git version 2.34.1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

南冥有猫 2025-02-11 17:36:58

vimdifftool = vimdiff中实际上不是vimdiff。它是脚本这真的不允许您想要的东西。

可悲的是,-d标志,如$ git difftool -d中的标志无济于事。它打开了两个NetRW窗口,您可以有效地查看哪些文件具有更改,但是整个用户体验比重复:qa&lt; cr&gt;更笨拙。 :

imo,与GUI difftools提供的UX相比,屁股很痛苦:

=“ https://i.sstatic.net/ufq6f.png” alt =“ filemerge”>

但是,由于您提到了QuickFix,因此您可能喜欢 git-jump ,可以让您这样做:

$ git jump diff

“

这非常适合从一个变化到另一种变化到另一种变化但实际上并不能解决查看实际差异的问题。

也许是第三方插件,例如这个可以有所帮助,但您必须提出一个适当的GIT整合。

这听起来像是一个很酷的周末项目。

The vimdiff in tool = vimdiff is not actually vimdiff. It's a script that doesn't really allow for what you want.

Sadly, the -d flag, as in $ git difftool -d, is not helpful as is. It opens two Netrw windows where you can effectively see which files have changes but the whole user experience is a lot more clunky than repeating :qa<CR>, even a hundred times:

vimdiff

IMO, it's a pain in the ass compared to the UX provided in GUI difftools:

filemerge

But, since you mentioned the quickfix, you might like git-jump, which lets you do:

$ git jump diff

git-jump

Which is pretty good for navigating from one change to another but doesn't really help solving the problem of seeing the actual diff.

Maybe a third-party plugin like this one could help but you would have to come up with a proper Git integration.

That sounds like a cool week-end project.

小…红帽 2025-02-11 17:36:58
git difftool -d

您可以

  1. j k移动到选定的dir,按Enter打开DIR
  2. MOVE CURSOR,您想打开文件
  3. t以打开t以打开tab中的文件,请按new tab
  4. 按gt或gt返回dir buffer(netrw
  5. ctrl+w ctrl+w ctrl+w shift shift左缓冲区和左缓冲区和RIFHT缓冲区
  6. 再次执行1 2 3
  7. 现在您有打开3个选项卡,但是只有2个缓冲区(文件)操作
  8. GT或GT到具有显示文件缓冲区的任何选项卡
  9. :vsp:vsp to Split垂直窗口
  10. :bp:bp:bp
  11. :windo diffthis diffthis

i code一个vim脚本以扩展netrw树,所以我可以搜索它,
也可以轻松打开DIFF ...

git difftool -d

you can

  1. j k moving to selected dir, presse enter to open dir
  2. move cursor to you want to open file
  3. pressed t to open file in new tab
  4. press gt or gT to go back dir buffer(netrw
  5. ctrl+w ctrl+w shift left buffer and rifht buffer
  6. do again 1 2 3
  7. now you have open 3 tab,but only 2 buffer(file) opend
  8. gt or gT to any tab that has display a file buffer
  9. :vsp to split vertical window
  10. :bn or :bp
  11. :windo diffthis

i code a vim scrip to expand netrw tree at all ,so i can search it ,
also can open diff easy...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文