altsem / gitu

A TUI Git client inspired by Magit
MIT License
1.79k stars 93 forks source link

Search #5

Open altsem opened 7 months ago

altsem commented 7 months ago

Search down/up in any screen. Bind to / and ?, n and N to go to next/prev?

n is currently bound to moving the cursor down. May want to bind ? to help. Does it make more sense to have separate vim/emacs-like keybind profiles?

mattgallagher92 commented 6 months ago

This would be great!

My guess is that people who prefer Emacs-like keybindings are likely to use Emacs and prefer to stay in Emacs, hence use Magit rather than gitu. So I'd argue that it makes sense to focus on making a good workflow for those using vim-style keybindings (which seems to be gitu's default). In particular, I'd support removing the p and n bindings to select previous/next to enable them to be used for other things.

(Note: I use vim-style keybindings for code editing and I'm a Magit user who basically only uses Emacs - with Evil mode for vi-style keybindings - for Magit, so I bring some hefty bias :sweat_smile:)

That said, it's going to be hard to get anything perfect - I'd love to be able to use h and l for fine-grained text selection when in visual mode (for example to search for a commit by message, then copy something like the hash), but there are obvious conflicts with help and log actions. You could get around that with full-on modes like Vim has, but I imagine that adds significant implementation complexity, and increases the barrier to entry for those not used to Vim. Certainly not worth consideration in the short term.

altsem commented 6 months ago

I think dropping n/p for navigation might be reasonable. In the future, the keybinds should be configurable anyway. Been thinking about adding a "copy hash" keybind somewhere.