mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-31 14:24:25 +03:00
Make keybindings for the "Amend attribute" menu configurable
This commit is contained in:
committed by
Stefan Haller
parent
b1523c3f07
commit
e1b341e174
@ -279,6 +279,10 @@ keybinding:
|
|||||||
bulkMenu: 'b'
|
bulkMenu: 'b'
|
||||||
commitMessage:
|
commitMessage:
|
||||||
switchToEditor: '<c-o>'
|
switchToEditor: '<c-o>'
|
||||||
|
amendAttribute:
|
||||||
|
addCoAuthor: 'c'
|
||||||
|
resetAuthor: 'a'
|
||||||
|
setAuthor: 'A'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Platform Defaults
|
## Platform Defaults
|
||||||
|
@ -281,17 +281,18 @@ type UpdateConfig struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type KeybindingConfig struct {
|
type KeybindingConfig struct {
|
||||||
Universal KeybindingUniversalConfig `yaml:"universal"`
|
Universal KeybindingUniversalConfig `yaml:"universal"`
|
||||||
Status KeybindingStatusConfig `yaml:"status"`
|
Status KeybindingStatusConfig `yaml:"status"`
|
||||||
Files KeybindingFilesConfig `yaml:"files"`
|
Files KeybindingFilesConfig `yaml:"files"`
|
||||||
Branches KeybindingBranchesConfig `yaml:"branches"`
|
Branches KeybindingBranchesConfig `yaml:"branches"`
|
||||||
Worktrees KeybindingWorktreesConfig `yaml:"worktrees"`
|
Worktrees KeybindingWorktreesConfig `yaml:"worktrees"`
|
||||||
Commits KeybindingCommitsConfig `yaml:"commits"`
|
Commits KeybindingCommitsConfig `yaml:"commits"`
|
||||||
Stash KeybindingStashConfig `yaml:"stash"`
|
AmendAttribute KeybindingAmendAttributeConfig `yaml:"amendAttribute"`
|
||||||
CommitFiles KeybindingCommitFilesConfig `yaml:"commitFiles"`
|
Stash KeybindingStashConfig `yaml:"stash"`
|
||||||
Main KeybindingMainConfig `yaml:"main"`
|
CommitFiles KeybindingCommitFilesConfig `yaml:"commitFiles"`
|
||||||
Submodules KeybindingSubmodulesConfig `yaml:"submodules"`
|
Main KeybindingMainConfig `yaml:"main"`
|
||||||
CommitMessage KeybindingCommitMessageConfig `yaml:"commitMessage"`
|
Submodules KeybindingSubmodulesConfig `yaml:"submodules"`
|
||||||
|
CommitMessage KeybindingCommitMessageConfig `yaml:"commitMessage"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// damn looks like we have some inconsistencies here with -alt and -alt1
|
// damn looks like we have some inconsistencies here with -alt and -alt1
|
||||||
@ -440,6 +441,12 @@ type KeybindingCommitsConfig struct {
|
|||||||
StartInteractiveRebase string `yaml:"startInteractiveRebase"`
|
StartInteractiveRebase string `yaml:"startInteractiveRebase"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type KeybindingAmendAttributeConfig struct {
|
||||||
|
ResetAuthor string `yaml:"resetAuthor"`
|
||||||
|
SetAuthor string `yaml:"setAuthor"`
|
||||||
|
AddCoAuthor string `yaml:"addCoAuthor"`
|
||||||
|
}
|
||||||
|
|
||||||
type KeybindingStashConfig struct {
|
type KeybindingStashConfig struct {
|
||||||
PopStash string `yaml:"popStash"`
|
PopStash string `yaml:"popStash"`
|
||||||
RenameStash string `yaml:"renameStash"`
|
RenameStash string `yaml:"renameStash"`
|
||||||
@ -836,6 +843,11 @@ func GetDefaultConfig() *UserConfig {
|
|||||||
ViewBisectOptions: "b",
|
ViewBisectOptions: "b",
|
||||||
StartInteractiveRebase: "i",
|
StartInteractiveRebase: "i",
|
||||||
},
|
},
|
||||||
|
AmendAttribute: KeybindingAmendAttributeConfig{
|
||||||
|
ResetAuthor: "a",
|
||||||
|
SetAuthor: "A",
|
||||||
|
AddCoAuthor: "c",
|
||||||
|
},
|
||||||
Stash: KeybindingStashConfig{
|
Stash: KeybindingStashConfig{
|
||||||
PopStash: "g",
|
PopStash: "g",
|
||||||
RenameStash: "r",
|
RenameStash: "r",
|
||||||
|
@ -673,25 +673,26 @@ func (self *LocalCommitsController) canAmend(commit *models.Commit) *types.Disab
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (self *LocalCommitsController) amendAttribute(commit *models.Commit) error {
|
func (self *LocalCommitsController) amendAttribute(commit *models.Commit) error {
|
||||||
|
opts := self.c.KeybindingsOpts()
|
||||||
return self.c.Menu(types.CreateMenuOptions{
|
return self.c.Menu(types.CreateMenuOptions{
|
||||||
Title: "Amend commit attribute",
|
Title: "Amend commit attribute",
|
||||||
Items: []*types.MenuItem{
|
Items: []*types.MenuItem{
|
||||||
{
|
{
|
||||||
Label: self.c.Tr.ResetAuthor,
|
Label: self.c.Tr.ResetAuthor,
|
||||||
OnPress: self.resetAuthor,
|
OnPress: self.resetAuthor,
|
||||||
Key: 'a',
|
Key: opts.GetKey(opts.Config.AmendAttribute.ResetAuthor),
|
||||||
Tooltip: self.c.Tr.ResetAuthorTooltip,
|
Tooltip: self.c.Tr.ResetAuthorTooltip,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: self.c.Tr.SetAuthor,
|
Label: self.c.Tr.SetAuthor,
|
||||||
OnPress: self.setAuthor,
|
OnPress: self.setAuthor,
|
||||||
Key: 'A',
|
Key: opts.GetKey(opts.Config.AmendAttribute.SetAuthor),
|
||||||
Tooltip: self.c.Tr.SetAuthorTooltip,
|
Tooltip: self.c.Tr.SetAuthorTooltip,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Label: self.c.Tr.AddCoAuthor,
|
Label: self.c.Tr.AddCoAuthor,
|
||||||
OnPress: self.addCoAuthor,
|
OnPress: self.addCoAuthor,
|
||||||
Key: 'c',
|
Key: opts.GetKey(opts.Config.AmendAttribute.AddCoAuthor),
|
||||||
Tooltip: self.c.Tr.AddCoAuthorTooltip,
|
Tooltip: self.c.Tr.AddCoAuthorTooltip,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1163,6 +1163,24 @@
|
|||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
"amendAttribute": {
|
||||||
|
"properties": {
|
||||||
|
"resetAuthor": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "a"
|
||||||
|
},
|
||||||
|
"setAuthor": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "A"
|
||||||
|
},
|
||||||
|
"addCoAuthor": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "c"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
"stash": {
|
"stash": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"popStash": {
|
"popStash": {
|
||||||
|
Reference in New Issue
Block a user