tpope / vim-fugitive

fugitive.vim: A Git wrapper so awesome, it should be illegal
https://www.vim.org/scripts/script.php?script_id=2975
20.01k stars 1.01k forks source link

Implement counterpart for ``-`` mapping in ``:Git log`` #2328

Closed jclsn closed 2 months ago

jclsn commented 2 months ago

I have found that you can navigate down the commit history by pressing -. This mapping is undocumented in seems and there also is not counterpart +. Would it be possible to create one?

I have looked at the NavigateUp and DirRev functions, but it is not obvious to me how to achieve that.

tpope commented 2 months ago

No, that's not how Git works. Commits know about their parents but not their children. You can find children by hunting through the history of a branch, but which branch to hunt through is subjective. For example, the children that exist on main and the children that exist on dev might be different.

jclsn commented 2 months ago

I see. Would just have a nice way to jump back and forward through my merge request without having to open the browser. Works with :Gclog and the quickfix list, but for the kernel this is not usable.

jclsn commented 2 months ago

Ah :Gclog -n 100 works like a charm

tpope commented 2 months ago

Alternatively you can use :Gclog ^! to stop at the currently edited commit rather than after 100 commits.

jclsn commented 2 months ago

How does that work? I don't understand what is meant by "currently edited commit". For me it just shows nothing

tpope commented 2 months ago

Where are you using the - map?

jclsn commented 2 months ago

I have my command Glog :Git log --oneline --decorate --graph -500 command and I am using it in there

tpope commented 2 months ago

A command doesn't answer the question. What buffer are you using the - map in? The first result?

jclsn commented 2 months ago

In the buffer of the diff, but no matter in which buffer I execute :Gclog ^! in, it just returns me an empty buffer

tpope commented 2 months ago

In the buffer of the diff,

The first buffer that opens is the top most commit. It has no children. So it will not list anything.

but no matter in which buffer I execute :Gclog ^! in, it just returns me an empty buffer

Are you just trying it in random files? Those don't have child commits either.

jclsn commented 2 months ago

The first buffer that opens is the top most commit. It has no children. So it will not list anything.

I did not try in the first commit, but in one further down.

Are you just trying it in random files? Those don't have child commits either.

I have been trying in many commits and files now. The list is alway empty

tpope commented 2 months ago

I guess it needs a starting point too. Try :Gclog @ ^! to use the currently checked out branch.

jclsn commented 2 months ago

Yep, that works! Thx

On Aug. 19 2024, at 6:07 pm, Tim Pope @.***> wrote:

I guess it needs a starting point too. Try :Gclog @ ^! to use the currently checked out branch. — Reply to this email directly, view it on GitHub (https://github.com/tpope/vim-fugitive/issues/2328#issuecomment-2296932971), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AEW47N76HZ26OYZN4RNDMPDZSIJ43AVCNFSM6AAAAABMPZWE66VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJWHEZTEOJXGE). You are receiving this because you authored the thread.