From e356b29b4a7888a24bca6b3784b9df5b2e3fa34c Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Thu, 27 Jul 2023 19:01:40 +1000 Subject: [PATCH] Allow entering a submodule by pressing space --- docs/keybindings/Keybindings_en.md | 2 ++ docs/keybindings/Keybindings_ja.md | 2 ++ docs/keybindings/Keybindings_ko.md | 2 ++ docs/keybindings/Keybindings_nl.md | 2 ++ docs/keybindings/Keybindings_pl.md | 2 ++ docs/keybindings/Keybindings_ru.md | 2 ++ docs/keybindings/Keybindings_zh-CN.md | 2 ++ docs/keybindings/Keybindings_zh-TW.md | 2 ++ pkg/gui/controllers/submodules_controller.go | 5 +++++ 9 files changed, 21 insertions(+) diff --git a/docs/keybindings/Keybindings_en.md b/docs/keybindings/Keybindings_en.md index 2d8701483..3357d3619 100644 --- a/docs/keybindings/Keybindings_en.md +++ b/docs/keybindings/Keybindings_en.md @@ -317,6 +317,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
   <c-o>: Copy submodule name to clipboard
   <enter>: Enter submodule
+  <space>: Enter submodule
   d: Remove submodule
   u: Update submodule
   n: Add new submodule
@@ -344,6 +345,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   n: Create worktree
   <space>: Switch to worktree
+  <enter>: Switch to worktree
   o: Open in editor
   d: Remove worktree
   /: Filter the current view by text
diff --git a/docs/keybindings/Keybindings_ja.md b/docs/keybindings/Keybindings_ja.md
index ff41c92a2..1adf2de3a 100644
--- a/docs/keybindings/Keybindings_ja.md
+++ b/docs/keybindings/Keybindings_ja.md
@@ -79,6 +79,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   n: Create worktree
   <space>: Switch to worktree
+  <enter>: Switch to worktree
   o: Open in editor
   d: Remove worktree
   /: Filter the current view by text
@@ -146,6 +147,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   <c-o>: サブモジュール名をクリップボードにコピー
   <enter>: サブモジュールを開く
+  <space>: サブモジュールを開く
   d: サブモジュールを削除
   u: サブモジュールを更新
   n: サブモジュールを新規追加
diff --git a/docs/keybindings/Keybindings_ko.md b/docs/keybindings/Keybindings_ko.md
index adafbe1e5..837043947 100644
--- a/docs/keybindings/Keybindings_ko.md
+++ b/docs/keybindings/Keybindings_ko.md
@@ -96,6 +96,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   n: Create worktree
   <space>: Switch to worktree
+  <enter>: Switch to worktree
   o: Open in editor
   d: Remove worktree
   /: Filter the current view by text
@@ -210,6 +211,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   <c-o>: 서브모듈 이름을 클립보드에 복사
   <enter>: 서브모듈 열기
+  <space>: 서브모듈 열기
   d: 서브모듈 삭제
   u: 서브모듈 업데이트
   n: 새로운 서브모듈 추가
diff --git a/docs/keybindings/Keybindings_nl.md b/docs/keybindings/Keybindings_nl.md
index e63fde865..13010a4d1 100644
--- a/docs/keybindings/Keybindings_nl.md
+++ b/docs/keybindings/Keybindings_nl.md
@@ -317,6 +317,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   <c-o>: Kopieer submodule naam naar klembord
   <enter>: Enter submodule
+  <space>: Enter submodule
   d: Remove submodule
   u: Update submodule
   n: Voeg nieuwe submodule toe
@@ -344,6 +345,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   n: Create worktree
   <space>: Switch to worktree
+  <enter>: Switch to worktree
   o: Open in editor
   d: Remove worktree
   /: Filter the current view by text
diff --git a/docs/keybindings/Keybindings_pl.md b/docs/keybindings/Keybindings_pl.md
index ce666dd0a..9876d26a7 100644
--- a/docs/keybindings/Keybindings_pl.md
+++ b/docs/keybindings/Keybindings_pl.md
@@ -310,6 +310,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   <c-o>: Copy submodule name to clipboard
   <enter>: Enter submodule
+  <space>: Enter submodule
   d: Remove submodule
   u: Update submodule
   n: Add new submodule
@@ -337,6 +338,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   n: Create worktree
   <space>: Switch to worktree
+  <enter>: Switch to worktree
   o: Open in editor
   d: Remove worktree
   /: Filter the current view by text
diff --git a/docs/keybindings/Keybindings_ru.md b/docs/keybindings/Keybindings_ru.md
index 8da16f7f6..fa59d9949 100644
--- a/docs/keybindings/Keybindings_ru.md
+++ b/docs/keybindings/Keybindings_ru.md
@@ -49,6 +49,7 @@ _Связки клавиш_
 
   n: Create worktree
   <space>: Switch to worktree
+  <enter>: Switch to worktree
   o: Open in editor
   d: Remove worktree
   /: Filter the current view by text
@@ -229,6 +230,7 @@ _Связки клавиш_
 
   <c-o>: Скопировать название подмодуля в буфер обмена
   <enter>: Ввести подмодуль
+  <space>: Ввести подмодуль
   d: Удалить подмодуль
   u: Обновить подмодуль
   n: Добавить новый подмодуль
diff --git a/docs/keybindings/Keybindings_zh-CN.md b/docs/keybindings/Keybindings_zh-CN.md
index 0bb8336cf..1fcfe987f 100644
--- a/docs/keybindings/Keybindings_zh-CN.md
+++ b/docs/keybindings/Keybindings_zh-CN.md
@@ -66,6 +66,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   n: Create worktree
   <space>: Switch to worktree
+  <enter>: Switch to worktree
   o: Open in editor
   d: Remove worktree
   /: Filter the current view by text
@@ -118,6 +119,7 @@ _Legend: `` means ctrl+b, `` means alt+b, `B` means shift+b_
 
   <c-o>: 将子模块名称复制到剪贴板
   <enter>: 输入子模块
+  <space>: 输入子模块
   d: 删除子模块
   u: 更新子模块
   n: 添加新的子模块
diff --git a/docs/keybindings/Keybindings_zh-TW.md b/docs/keybindings/Keybindings_zh-TW.md
index 75a36ccbe..960eee73a 100644
--- a/docs/keybindings/Keybindings_zh-TW.md
+++ b/docs/keybindings/Keybindings_zh-TW.md
@@ -66,6 +66,7 @@ _說明:`` 表示 Ctrl+B、`` 表示 Alt+B,`B`表示 Shift+B_
 
   n: Create worktree
   <space>: Switch to worktree
+  <enter>: Switch to worktree
   o: Open in editor
   d: Remove worktree
   /: Filter the current view by text
@@ -162,6 +163,7 @@ _說明:`` 表示 Ctrl+B、`` 表示 Alt+B,`B`表示 Shift+B_
 
   <c-o>: 複製子模組名稱到剪貼簿
   <enter>: 進入子模組
+  <space>: 進入子模組
   d: 移除子模組
   u: 更新子模組
   n: 新增子模組
diff --git a/pkg/gui/controllers/submodules_controller.go b/pkg/gui/controllers/submodules_controller.go
index b2cb00635..ebf597d3b 100644
--- a/pkg/gui/controllers/submodules_controller.go
+++ b/pkg/gui/controllers/submodules_controller.go
@@ -35,6 +35,11 @@ func (self *SubmodulesController) GetKeybindings(opts types.KeybindingsOpts) []*
 			Handler:     self.checkSelected(self.enter),
 			Description: self.c.Tr.EnterSubmodule,
 		},
+		{
+			Key:         opts.GetKey(opts.Config.Universal.Select),
+			Handler:     self.checkSelected(self.enter),
+			Description: self.c.Tr.EnterSubmodule,
+		},
 		{
 			Key:         opts.GetKey(opts.Config.Universal.Remove),
 			Handler:     self.checkSelected(self.remove),