mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-10 20:05:50 +02:00
Add return-alt1 to allow for a secondary Return key
This partially adds the feature back that was removed in #2495. This allows specifing a secondary Return keybinding. In my personal setup I use the `q` for this (and remove it as the default for Quit). Returning is a very common operation in lazygit, and having to reach for the Escape key all the time is annoying. There are cases where it's not possible to use a regular letter as the Return keybinding, such as the commit prompt.
This commit is contained in:
parent
f598da0df2
commit
9812d2fca4
12 changed files with 45 additions and 0 deletions
|
@ -449,6 +449,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>
|
||||
|
|
|
@ -344,6 +344,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"`
|
||||
|
|
|
@ -31,6 +31,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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -119,6 +119,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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -70,6 +70,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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue