Skip to content

Commit 93b3198

Browse files
stefanhallerkarolzwolak
authored andcommitted
Make it possible to rebind the Confirm keybinding (jesseduffield#4860)
### PR Description Remapping `keybinding.universal.confirm` from `<enter>` to something like `y` is currently impossible because the same keybinding is also used to confirm prompts (e.g. "New branch") and the search prompt. Fix this by hard-coding enter for those; it doesn't really make sense to use any other key for prompts. While at it, add separate bindings for `confirmMenu` and `confirmSuggestion` for those who would like to have different keys for these. Of these, `confirmMenu` could be a little tricky because menus are sometimes used purely as a choice (e.g. in "Amend commit attribute" or the global keybindings menu), in which case you might want to use `<enter>`, but other times as a substitute for a confirmation (e.g. for "Delete branch"), in which case you might want to remap to `y`. I don't have a great idea what to do about that, to be honest. Feedback welcome. In this PR we only take care of Confirm, which many people seem to be concerned about. We might consider doing something similar for Esc, but it seems less urgent, and I'm out of time now. 😄 This seemingly simple change required some serious refactoring under the hood, so thorough testing would be good to ensure we didn't break anything. Closes jesseduffield#2611 Closes jesseduffield#2767 Closes jesseduffield#3471 Related: jesseduffield#2768
2 parents aa1eeb2 + fb8a191 commit 93b3198

36 files changed

+364
-155
lines changed

docs/Config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,8 @@ keybinding:
557557
select: <space>
558558
goInto: <enter>
559559
confirm: <enter>
560+
confirmMenu: <enter>
561+
confirmSuggestion: <enter>
560562
confirmInEditor: <a-enter>
561563
confirmInEditor-alt: <c-s>
562564
remove: d

docs/keybindings/Keybindings_en.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
160160
| `` 0 `` | Focus main view | |
161161
| `` / `` | Search the current view by text | |
162162

163+
## Input prompt
164+
165+
| Key | Action | Info |
166+
|-----|--------|-------------|
167+
| `` <enter> `` | Confirm | |
168+
| `` <esc> `` | Close/Cancel | |
169+
163170
## Local branches
164171

165172
| Key | Action | Info |

docs/keybindings/Keybindings_ja.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ _凡例:`<c-b>` はctrl+b、`<a-b>` はalt+b、`B` はshift+bを意味
5252
| `` ] `` | 次のタブ | |
5353
| `` [ `` | 前のタブ | |
5454

55+
## Input prompt
56+
57+
| Key | Action | Info |
58+
|-----|--------|-------------|
59+
| `` <enter> `` | 確認 | |
60+
| `` <esc> `` | 閉じる/キャンセル | |
61+
5562
## コミット
5663

5764
| Key | Action | Info |

docs/keybindings/Keybindings_ko.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
5252
| `` ] `` | 이전 탭 | |
5353
| `` [ `` | 다음 탭 | |
5454

55+
## Input prompt
56+
57+
| Key | Action | Info |
58+
|-----|--------|-------------|
59+
| `` <enter> `` | 확인 | |
60+
| `` <esc> `` | 닫기/취소 | |
61+
5562
## Reflog
5663

5764
| Key | Action | Info |

docs/keybindings/Keybindings_nl.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,13 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
190190
| `` w `` | View worktree options | |
191191
| `` / `` | Start met zoeken | |
192192

193+
## Input prompt
194+
195+
| Key | Action | Info |
196+
|-----|--------|-------------|
197+
| `` <enter> `` | Bevestig | |
198+
| `` <esc> `` | Sluiten | |
199+
193200
## Menu
194201

195202
| Key | Action | Info |

docs/keybindings/Keybindings_pl.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ _Legenda: `<c-b>` oznacza ctrl+b, `<a-b>` oznacza alt+b, `B` oznacza shift+b_
125125
| `` <esc> `` | Wyjdź z budowniczego niestandardowej łatki | |
126126
| `` / `` | Szukaj w bieżącym widoku po tekście | |
127127

128+
## Input prompt
129+
130+
| Key | Action | Info |
131+
|-----|--------|-------------|
132+
| `` <enter> `` | Potwierdź | |
133+
| `` <esc> `` | Zamknij/Anuluj | |
134+
128135
## Lokalne gałęzie
129136

130137
| Key | Action | Info |

docs/keybindings/Keybindings_pt.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
218218
| `` w `` | View worktree options | |
219219
| `` / `` | Filter the current view by text | |
220220

221+
## Input prompt
222+
223+
| Key | Action | Info |
224+
|-----|--------|-------------|
225+
| `` <enter> `` | Confirmar | |
226+
| `` <esc> `` | Fechar/Cancelar | |
227+
221228
## Menu
222229

223230
| Key | Action | Info |

docs/keybindings/Keybindings_ru.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ _Связки клавиш_
5252
| `` ] `` | Следующая вкладка | |
5353
| `` [ `` | Предыдущая вкладка | |
5454

55+
## Input prompt
56+
57+
| Key | Action | Info |
58+
|-----|--------|-------------|
59+
| `` <enter> `` | Подтвердить | |
60+
| `` <esc> `` | Закрыть/отменить | |
61+
5562
## Worktrees
5663

5764
| Key | Action | Info |

docs/keybindings/Keybindings_zh-CN.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
5252
| `` ] `` | 下一个标签 | |
5353
| `` [ `` | 上一个标签 | |
5454

55+
## Input prompt
56+
57+
| Key | Action | Info |
58+
|-----|--------|-------------|
59+
| `` <enter> `` | 确认 | |
60+
| `` <esc> `` | 关闭 | |
61+
5562
## Reflog
5663

5764
| Key | Action | Info |

docs/keybindings/Keybindings_zh-TW.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ _說明:`<c-b>` 表示 Ctrl+B、`<a-b>` 表示 Alt+B,`B`表示 Shift+B
5252
| `` ] `` | 下一個索引標籤 | |
5353
| `` [ `` | 上一個索引標籤 | |
5454

55+
## Input prompt
56+
57+
| Key | Action | Info |
58+
|-----|--------|-------------|
59+
| `` <enter> `` | 確認 | |
60+
| `` <esc> `` | 關閉/取消 | |
61+
5562
## 主面板 (補丁生成)
5663

5764
| Key | Action | Info |

0 commit comments

Comments
 (0)