Closed altsem closed 5 months ago
Given v0.6.2
, I would recommend the following:
Display all available optional flags in a new window, similar to the screenshot in the body of this issue:
-f
/--force
for git push
would be used upon hitting the f
key.Otherwise, an arbitrary letter that doesn’t collide with the others on screen could be highlighted and used as trigger, similarly to how btop
does it:
Example:
# Run Gitu
$ gitu
# Push the branch with argument
alt-p
# Select the force flag in the upcoming window
f
# Gitu runs `git push --force`
HTH!
I appreciate the input, think that most people would expect magit-like bindings out of gitu. I'm unfamiliar with btop, perhaps there's a way to design it configurable.
I know alt
can be problematic for mac terminal users with non-us layouts.
Perhaps if the dash was included in the bindings table -f
(for --force-with-lease).
You'd just have to copy the default keymap and change:
-f
-> f
etc.
p
-> alt-p
Externalizing keymap configuration becomes a whole other issue it feels like though.
I'm excited to see so much activity on this library! I use Magit with vi-style keybindings and would love to have a similar experience outside of Emacs.
Just wanted to note that this issue is the main blocker stopping me (so maybe others too?) from switching to gitu - I fairly regularly amend commits or interactively rebase branches that I've pushed, hence often force-with-lease-push too.
I realised that the functionality needs to assume that multiple flags might need to be toggled, which the single-modifier proposal doesn’t solve.
Alternatively, here’s a way that e.g. Kitty (and some Vim-type bindings for the browser I can’t remember, whenever jumping to a hyperlink) uses:
In the menu that shows all possible flags to be passed to the underlying command, a special keyboard mapping is hit. Example: shift+ctrl+e
Single letters (or combinations of successive letters, to avoid collisions) are highlighted on screen. They must be already visible prior to hitting the combination above, or be generated and inserted dynamically into view. Examples (brackets = highlighted):
- `-[f] force push`
- `[f]orce push`
- `[0] force push`
- `[f]orce [p]ush`
- [00] force push`
The use hits the highlighted letters/combinations associated with the flags to select.
Selected flags (or their associated letter) should be shown somewhere on the view.
Example: Selected flags: -f
HTH.
Externalizing keymap configuration becomes a whole other issue it feels like though.
Yes, and a ton of work too! If you don’t particularly want to tackle this now, I reckon it’s best to focusing on finding good defaults, first.
Got something working for a starter.
It only supports true/false flags, and it only introduces --force-with-lease
so far. Should be easy to add more boolean flags now.
Build support for passing flags to commands (for example
git push --force-with-lease
, orP-fp
in Magit).