From 527c025a0c6a445230b88dfa2d4197554e5fc130 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 25 May 2019 16:37:47 +1000 Subject: [PATCH] use shift+j/k to scroll main, ctrl+j/k to move commits --- docs/keybindings/Keybindings_en.md | 4 ++-- docs/keybindings/Keybindings_nl.md | 18 +++++++++--------- docs/keybindings/Keybindings_pl.md | 4 ++-- pkg/gui/keybindings.go | 20 ++++++++++++++++++-- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index 8f941ad22..1ad719251 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -65,8 +65,8 @@ F: create fixup commit for this commit S: squash above commits d: delete commit - J: move commit down one - K: move commit up one + ctrl+j: move commit down one + ctrl+k: move commit up one e: edit commit A: amend commit with staged changes p: pick commit (when mid-rebase) diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md index 9ed20165f..fb0972ea6 100644 --- a/docs/keybindings/Keybindings_nl.md +++ b/docs/keybindings/Keybindings_nl.md @@ -65,8 +65,8 @@ F: creëer fixup commit voor deze commit S: squash bovenstaande commits d: verwijder commit - J: verplaats commit 1 omlaag - K: verplaats commit 1 omhoog + ctrl+j: verplaats commit 1 omlaag + ctrl+k: verplaats commit 1 omhoog e: verander commit A: wijzig commit met staged veranderingen p: pick commit (when mid-rebase) @@ -95,13 +95,6 @@ o: open bestand -## Hoofd (Normaal) - -
-  PgDn: scroll omlaag (fn+up)
-  PgUp: scroll omhoog (fn+down)
-
- ## Hoofd (Stage Lines/Hunks)
@@ -126,3 +119,10 @@
   : selecteer onderste hunk
   z: ongedaan maken
 
+ +## Hoofd (Normaal) + +
+  PgDn: scroll omlaag (fn+up)
+  PgUp: scroll omhoog (fn+down)
+
diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md index 0438c50ee..039d15089 100644 --- a/docs/keybindings/Keybindings_pl.md +++ b/docs/keybindings/Keybindings_pl.md @@ -65,8 +65,8 @@ F: create fixup commit for this commit S: squash above commits d: delete commit - J: move commit down one - K: move commit up one + ctrl+j: move commit down one + ctrl+k: move commit up one e: edit commit A: amend commit with staged changes p: pick commit (when mid-rebase) diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index c205d3384..5cbd7b6eb 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -29,6 +29,12 @@ func (b *Binding) GetKey() string { case rune: key = int(b.Key.(rune)) case gocui.Key: + if b.Key.(gocui.Key) == gocui.KeyCtrlJ { + return "ctrl+j" + } + if b.Key.(gocui.Key) == gocui.KeyCtrlK { + return "ctrl+k" + } key = int(b.Key.(gocui.Key)) } @@ -87,6 +93,16 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Modifier: gocui.ModNone, Handler: gui.scrollDownMain, Alternative: "fn+down", + }, { + ViewName: "", + Key: 'K', + Modifier: gocui.ModNone, + Handler: gui.scrollUpMain, + }, { + ViewName: "", + Key: 'J', + Modifier: gocui.ModNone, + Handler: gui.scrollDownMain, }, { ViewName: "", Key: gocui.KeyCtrlU, @@ -358,13 +374,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { Description: gui.Tr.SLocalize("deleteCommit"), }, { ViewName: "commits", - Key: 'J', + Key: gocui.KeyCtrlJ, Modifier: gocui.ModNone, Handler: gui.handleCommitMoveDown, Description: gui.Tr.SLocalize("moveDownCommit"), }, { ViewName: "commits", - Key: 'K', + Key: gocui.KeyCtrlK, Modifier: gocui.ModNone, Handler: gui.handleCommitMoveUp, Description: gui.Tr.SLocalize("moveUpCommit"),