lazyjj icon indicating copy to clipboard operation
lazyjj copied to clipboard

Add support to change 🎹 key bindings

Open eharrow opened this issue 1 year ago • 3 comments

As a user of zellij and lazyjj I want to be able to save the message using the describe popup which being ctrl-s conflicts with zellij (ctrl-s is search).

  1. Start lazyjj
  2. On a change in the log panel hit d for describe
  3. Add some text
  4. Use Ctrl-s to save it

Expected: The dialog is dismissed and the description for the change has been made. Actual: Zellij switches to search mode and it is not possible to save the change's description from lazyjj.

If I could change the key binding to something else in a config dot file this would fix my issue as I'd rather not have to make the key binding change in zellij.

  • [x] Log tab https://github.com/Cretezy/lazyjj/pull/94
  • [ ] Files tab https://github.com/Cretezy/lazyjj/pull/137
  • [ ] Bookmarks tab
  • [ ] Command log tab
  • [ ] Details pane

eharrow avatar Oct 29 '24 13:10 eharrow

I'm open to custom keybindings in the repo. I'll look into adding this. I'm open to PRs as well

Cretezy avatar Feb 15 '25 20:02 Cretezy

Partially done in #94 (for log tab). Other tabs can be added in the future

Cretezy avatar Mar 02 '25 19:03 Cretezy

Would be great if we could have this also for the details pane.

Right now I use a crude local patch for key inputs:

diff --git a/src/ui/details_panel.rs b/src/ui/details_panel.rs
index d6082e8..1455bf2 100644
--- a/src/ui/details_panel.rs
+++ b/src/ui/details_panel.rs
@@ -50,6 +50,17 @@ impl DetailsPanel {
     /// Handle input. Returns bool of if event was handled
     pub fn input(&mut self, key: KeyEvent) -> bool {
         match key.code {
+            KeyCode::Char(' ')
+                if key.modifiers.contains(KeyModifiers::CONTROL)
+                    && key.modifiers.contains(KeyModifiers::SHIFT) =>
+            {
+                self.scroll((self.height as isize / 2).saturating_neg())
+            }
+            KeyCode::Char(' ') if key.modifiers.contains(KeyModifiers::CONTROL) => {
+                self.scroll(self.height as isize / 2)
+            }
+            KeyCode::Char(' ') if key.modifiers.contains(KeyModifiers::SHIFT) => self.scroll(-1),
+            KeyCode::Char(' ') => self.scroll(1),
             KeyCode::Char('e') if key.modifiers.contains(KeyModifiers::CONTROL) => self.scroll(1),
             KeyCode::Char('y') if key.modifiers.contains(KeyModifiers::CONTROL) => self.scroll(-1),
             KeyCode::Char('d') if key.modifiers.contains(KeyModifiers::CONTROL) => {

fleimgruber avatar May 18 '25 11:05 fleimgruber