This commit is contained in:
Jelte Fennema-Nio 2025-05-05 18:54:51 +00:00 committed by GitHub
commit c7874a5791
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 45 additions and 0 deletions

View file

@ -476,6 +476,8 @@ keybinding:
quit: q
quit-alt1: <c-c>
return: <esc>
# When set to a printable character, this will work for returning from non-prompt panels
return-alt1: null
quitWithoutChangingDirectory: Q
togglePanel: <tab>
prevItem: <up>

View file

@ -374,6 +374,7 @@ type KeybindingUniversalConfig struct {
Quit string `yaml:"quit"`
QuitAlt1 string `yaml:"quit-alt1"`
Return string `yaml:"return"`
ReturnAlt1 string `yaml:"return-alt1"`
QuitWithoutChangingDirectory string `yaml:"quitWithoutChangingDirectory"`
TogglePanel string `yaml:"togglePanel"`
PrevItem string `yaml:"prevItem"`

View file

@ -34,6 +34,10 @@ func (self *CommitDescriptionController) GetKeybindings(opts types.KeybindingsOp
Key: opts.GetKey(opts.Config.Universal.Return),
Handler: self.close,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.close,
},
{
Key: opts.GetKey(opts.Config.Universal.ConfirmInEditor),
Handler: self.confirm,

View file

@ -37,6 +37,10 @@ func (self *ConfirmationController) GetKeybindings(opts types.KeybindingsOpts) [
Description: self.c.Tr.CloseCancel,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: func() error { return self.context().State.OnClose() },
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Handler: func() error {

View file

@ -121,6 +121,11 @@ func (self *GlobalController) GetKeybindings(opts types.KeybindingsOpts) []*type
Description: self.c.Tr.Cancel,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Modifier: gocui.ModNone,
Handler: self.escape,
},
{
Key: opts.GetKey(opts.Config.Universal.ToggleWhitespaceInDiffView),
Handler: self.toggleWhitespace,

View file

@ -50,6 +50,10 @@ func (self *MenuController) GetKeybindings(opts types.KeybindingsOpts) []*types.
Description: self.c.Tr.Close,
DisplayOnScreen: true,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.close,
},
}
return bindings

View file

@ -123,6 +123,10 @@ func (self *MergeConflictsController) GetKeybindings(opts types.KeybindingsOpts)
Handler: self.Escape,
Description: self.c.Tr.ReturnToFilesPanel,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.Escape,
},
}
return bindings

View file

@ -47,6 +47,10 @@ func (self *PatchBuildingController) GetKeybindings(opts types.KeybindingsOpts)
Handler: self.Escape,
Description: self.c.Tr.ExitCustomPatchBuilder,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.Escape,
},
}
}

View file

@ -33,6 +33,11 @@ func (self *SearchPromptController) GetKeybindings(opts types.KeybindingsOpts) [
Modifier: gocui.ModNone,
Handler: self.cancel,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Modifier: gocui.ModNone,
Handler: self.cancel,
},
{
Key: opts.GetKey(opts.Config.Universal.PrevItem),
Modifier: gocui.ModNone,

View file

@ -43,6 +43,10 @@ func (self *SnakeController) GetKeybindings(opts types.KeybindingsOpts) []*types
Key: opts.GetKey(opts.Config.Universal.Return),
Handler: self.Escape,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.Escape,
},
}
return bindings

View file

@ -72,6 +72,10 @@ func (self *StagingController) GetKeybindings(opts types.KeybindingsOpts) []*typ
Handler: self.Escape,
Description: self.c.Tr.ReturnToFilesPanel,
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: self.Escape,
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Handler: self.TogglePanel,

View file

@ -39,6 +39,10 @@ func (self *SuggestionsController) GetKeybindings(opts types.KeybindingsOpts) []
Key: opts.GetKey(opts.Config.Universal.Return),
Handler: func() error { return self.context().State.OnClose() },
},
{
Key: opts.GetKey(opts.Config.Universal.ReturnAlt1),
Handler: func() error { return self.context().State.OnClose() },
},
{
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
Handler: self.switchToConfirmation,