如何在选择特定提交后返回到 :Gblame 的结果?

10

从 vim-fugitive 插件的 README 中:fugitive:

:Gblame 命令将以交互式垂直拆分方式显示 git blame 输出。 在一行上按回车键可编辑更改该行的提交,或按 o 键在拆分视图中打开它。

在我编辑了一个特定的提交后,是否可以返回到 blame 输出呢?


1
你知道你将要返回到指责吗?如果是这样,你应该使用“o”而不是“<cr>”来查看提交。 - Peter Rincker
@Peter:好的。你能把这个加入答案里吗? - planetp
2个回答

19

I think what you may be looking for is -

Edit: What you actually want are O and o instead of <CR> if you know you will be going back to the commit.

Here are all the flags for the :Gblame command:

                                           *fugitive-:Gblame*
:Gblame [flags] 
 Run git-blame on the file and open the results in a
 scroll bound vertical split. You can give any of
 ltfnsewMC as flags and they will be passed along to
 git-blame. The following maps, which work on the
 cursor line commit where sensible, are provided:

     g? show this help
     A resize to end of author column
     C resize to end of commit column
     D resize to end of date/time column
     q close blame and return to blamed window
     gq q, then |:Gedit| to return to work tree version
     <CR> q, then open commit
     o open commit in horizontal split
     O open commit in new tab
     - reblame at commit
     ~ reblame at [count]th first grandparent
     P reblame at [count]th parent (like HEAD^[count])
有关Fugitive命令的更多信息,请查看此处

1
不是的。对我来说,-会打开文件日志中的上一个提交。 - planetp
哦,其他标志有用吗?因为我认为这就是“:Gblame”命令的全部内容。 - Zach
我很高兴能够帮助,即使我的初始建议是错误的。我会编辑答案,以便未来有相同问题的人可以参考。 - Zach

1

另一个选项- 仅使用vim命令返回之前的缓冲区:

由于在vim-fugitive中按下'enter'会在旧缓冲区顶部打开一个新的vim缓冲区 - 您可以简单地使用vim命令返回:

:b 1 

前往缓冲区1。

如果已经打开了太多的缓冲区,您可以列出它们:

:buffers

问题在于:G blame命令会在垂直分割中产生两个缓冲区:一个是包含责备信息的缓冲区,与文件内容的缓冲区并排显示(并且与之绑定滚动),而:b 1命令只会恢复其中一个缓冲区。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接