jonas/tig

Default main view / jump to "Staged/Unstaged changes"

Opened this issue · 5 comments

An (via tigrc or bindable command) option to jump to one of the "Staged changes", "Unstaged changes", "HEAD" in the main view would be handy.

There is already a default binding to jump to HEAD (H). There is no binding for Staged changes and Unstaged changes but they are generally located next to HEAD. If you really want a binding, you can add one to your .tigrc taking @ as an example.

Right. But ATM there's nothing like the 'HEAD' ref for staged/unstaged, or is it? I see e.g. LINE_STAT_UNSTAGED in the code, but can't figure out anything that could be used as ":goto xyz".

Or you mean some hack with that "/^@@"? I don't see how to put anything like that into goto_id()...

It's not a hack, :/Unstaged changes will look for lines containing the text Unstaged changes. You can't use goto, it requires a ref argument.

Cool, that works, as does just simply '/Unstaged changes', any specific reason why use ':/...'?

Last thing, it seems that I'd need something like #1328 , to do the following

:/Unstaged changes ; :enter

but it seems that (if I'm looking at the right code) run_prompt_command() / exec_run_request() doesn't have a way to split the command and/or terminate the search string. E.g. something like:

:/Unstaged changes/ ; :enter

I'm just asking, it's probably just a minor usecase, so if it's not possible, no problem...

Copy-paste from @, :/ is the original syntax. It is not possible to bind multiple commands at this time, the keybinding structure only references one request. Making it "multiple" might not be straightforward for the execution part.