summaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-10-02 07:32:48 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-10-02 08:09:42 +1000
commit7be474bd83a0fc01e67e1cfd92f1ed9e098b3bee (patch)
tree36b01e7b6531ef98f9f507f1ecc610070ebf52db /pkg
parent30b347861101a4a3f38a009ed8ef8b50860472ae (diff)
update keybindings
Diffstat (limited to 'pkg')
-rw-r--r--pkg/gui/keybindings.go56
-rw-r--r--pkg/gui/list_context.go20
-rw-r--r--pkg/i18n/dutch.go10
-rw-r--r--pkg/i18n/english.go19
4 files changed, 50 insertions, 55 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go
index 97b720b49..40f15ba56 100644
--- a/pkg/gui/keybindings.go
+++ b/pkg/gui/keybindings.go
@@ -21,6 +21,7 @@ type Binding struct {
Modifier gocui.Modifier
Description string
Alternative string
+ Tag string // e.g. 'navigation'. Used for grouping things in the cheatsheet
}
// GetDisplayStrings returns the display string of a file
@@ -635,18 +636,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
},
{
ViewName: "branches",
- Key: gui.getKey("universal.nextTab"),
- Handler: gui.handleNextTab,
- Description: gui.Tr.SLocalize("nextTab"),
- },
- {
- ViewName: "branches",
- Key: gui.getKey("universal.prevTab"),
- Handler: gui.handlePrevTab,
- Description: gui.Tr.SLocalize("prevTab"),
- },
- {
- ViewName: "branches",
Contexts: []string{REMOTE_BRANCHES_CONTEXT_KEY},
Key: gui.getKey("universal.return"),
Handler: gui.handleRemoteBranchesEscape,
@@ -675,18 +664,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
},
{
ViewName: "commits",
- Key: gui.getKey("universal.nextTab"),
- Handler: gui.handleNextTab,
- Description: gui.Tr.SLocalize("nextTab"),
- },
- {
- ViewName: "commits",
- Key: gui.getKey("universal.prevTab"),
- Handler: gui.handlePrevTab,
- Description: gui.Tr.SLocalize("prevTab"),
- },
- {
- ViewName: "commits",
Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY},
Key: gui.getKey("commits.squashDown"),
Handler: gui.handleCommitSquashDown,
@@ -1562,18 +1539,6 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
},
{
ViewName: "files",
- Key: gui.getKey("universal.nextTab"),
- Handler: gui.handleNextTab,
- Description: gui.Tr.SLocalize("nextTab"),
- },
- {
- ViewName: "files",
- Key: gui.getKey("universal.prevTab"),
- Handler: gui.handlePrevTab,
- Description: gui.Tr.SLocalize("prevTab"),
- },
- {
- ViewName: "files",
Contexts: []string{SUBMODULES_CONTEXT_KEY},
Key: gui.getKey("universal.copyToClipboard"),
Handler: gui.wrappedHandler(gui.handleCopySelectedSideContextItemToClipboard),
@@ -1644,6 +1609,25 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
bindings = append(bindings, &Binding{ViewName: "", Key: rune(i+1) + '0', Modifier: gocui.ModNone, Handler: gui.goToSideWindow(window)})
}
+ for viewName := range gui.viewTabContextMap() {
+ bindings = append(bindings, []*Binding{
+ {
+ ViewName: viewName,
+ Key: gui.getKey("universal.nextTab"),
+ Handler: gui.handleNextTab,
+ Description: gui.Tr.SLocalize("nextTab"),
+ Tag: "navigation",
+ },
+ {
+ ViewName: viewName,
+ Key: gui.getKey("universal.prevTab"),
+ Handler: gui.handlePrevTab,
+ Description: gui.Tr.SLocalize("prevTab"),
+ Tag: "navigation",
+ },
+ }...)
+ }
+
bindings = append(bindings, gui.getListContextKeyBindings()...)
return bindings
diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go
index 0edd80873..3e5bf8467 100644
--- a/pkg/gui/list_context.go
+++ b/pkg/gui/list_context.go
@@ -510,15 +510,15 @@ func (gui *Gui) getListContextKeyBindings() []*Binding {
for _, listContext := range gui.getListContexts() {
bindings = append(bindings, []*Binding{
- {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevItem-alt"), Modifier: gocui.ModNone, Handler: listContext.handlePrevLine},
- {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevItem"), Modifier: gocui.ModNone, Handler: listContext.handlePrevLine},
- {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gocui.MouseWheelUp, Modifier: gocui.ModNone, Handler: listContext.handlePrevLine},
- {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextItem-alt"), Modifier: gocui.ModNone, Handler: listContext.handleNextLine},
- {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextItem"), Modifier: gocui.ModNone, Handler: listContext.handleNextLine},
- {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevPage"), Modifier: gocui.ModNone, Handler: listContext.handlePrevPage, Description: gui.Tr.SLocalize("prevPage")},
- {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextPage"), Modifier: gocui.ModNone, Handler: listContext.handleNextPage, Description: gui.Tr.SLocalize("nextPage")},
- {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.gotoTop"), Modifier: gocui.ModNone, Handler: listContext.handleGotoTop, Description: gui.Tr.SLocalize("gotoTop")},
- {ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gocui.MouseWheelDown, Modifier: gocui.ModNone, Handler: listContext.handleNextLine},
+ {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevItem-alt"), Modifier: gocui.ModNone, Handler: listContext.handlePrevLine},
+ {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevItem"), Modifier: gocui.ModNone, Handler: listContext.handlePrevLine},
+ {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gocui.MouseWheelUp, Modifier: gocui.ModNone, Handler: listContext.handlePrevLine},
+ {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextItem-alt"), Modifier: gocui.ModNone, Handler: listContext.handleNextLine},
+ {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextItem"), Modifier: gocui.ModNone, Handler: listContext.handleNextLine},
+ {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.prevPage"), Modifier: gocui.ModNone, Handler: listContext.handlePrevPage, Description: gui.Tr.SLocalize("prevPage")},
+ {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.nextPage"), Modifier: gocui.ModNone, Handler: listContext.handleNextPage, Description: gui.Tr.SLocalize("nextPage")},
+ {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gui.getKey("universal.gotoTop"), Modifier: gocui.ModNone, Handler: listContext.handleGotoTop, Description: gui.Tr.SLocalize("gotoTop")},
+ {ViewName: listContext.ViewName, Tag: "navigation", Contexts: []string{listContext.ContextKey}, Key: gocui.MouseWheelDown, Modifier: gocui.ModNone, Handler: listContext.handleNextLine},
{ViewName: listContext.ViewName, Contexts: []string{listContext.ContextKey}, Key: gocui.MouseLeft, Modifier: gocui.ModNone, Handler: listContext.handleClick},
}...)
@@ -537,6 +537,7 @@ func (gui *Gui) getListContextKeyBindings() []*Binding {
Key: gui.getKey("universal.startSearch"),
Handler: openSearchHandler,
Description: gui.Tr.SLocalize("startSearch"),
+ Tag: "navigation",
},
{
ViewName: listContext.ViewName,
@@ -544,6 +545,7 @@ func (gui *Gui) getListContextKeyBindings() []*Binding {
Key: gui.getKey("universal.gotoBottom"),
Handler: gotoBottomHandler,
Description: gui.Tr.SLocalize("gotoBottom"),
+ Tag: "navigation",
},
}...)
}
diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go
index c90017896..f56d4c1c7 100644
--- a/pkg/i18n/dutch.go
+++ b/pkg/i18n/dutch.go
@@ -572,7 +572,7 @@ func addDutch(i18nObject *i18n.Bundle) error {
ID: "CommitMessageTitle",
Other: "Commit Bericht",
}, &i18n.Message{
- ID: "Local-BranchesTitle",
+ ID: "LocalBranchesTitle",
Other: "Branches Tab",
}, &i18n.Message{
ID: "SearchTitle",
@@ -581,7 +581,7 @@ func addDutch(i18nObject *i18n.Bundle) error {
ID: "TagsTitle",
Other: "Tags Tab",
}, &i18n.Message{
- ID: "Branch-CommitsTitle",
+ ID: "BranchCommitsTitle",
Other: "Commits Tab",
}, &i18n.Message{
ID: "MenuTitle",
@@ -593,10 +593,10 @@ func addDutch(i18nObject *i18n.Bundle) error {
ID: "CredentialsTitle",
Other: "Credentials",
}, &i18n.Message{
- ID: "Remote-BranchesTitle",
+ ID: "RemoteBranchesTitle",
Other: "Remote Branches (in Remotes tab)",
}, &i18n.Message{
- ID: "Patch-BuildingTitle",
+ ID: "PatchBuildingTitle",
Other: "Patch Bouwen",
}, &i18n.Message{
ID: "InformationTitle",
@@ -605,7 +605,7 @@ func addDutch(i18nObject *i18n.Bundle) error {
ID: "SecondaryTitle",
Other: "Secondary",
}, &i18n.Message{
- ID: "Reflog-CommitsTitle",
+ ID: "ReflogCommitsTitle",
Other: "Reflog Tab",
}, &i18n.Message{
ID: "Title",
diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go
index 9c79ccb7d..acaf233ff 100644
--- a/pkg/i18n/english.go
+++ b/pkg/i18n/english.go
@@ -580,7 +580,7 @@ func addEnglish(i18nObject *i18n.Bundle) error {
ID: "CommitMessageTitle",
Other: "Commit Message",
}, &i18n.Message{
- ID: "Local-BranchesTitle",
+ ID: "LocalBranchesTitle",
Other: "Branches Tab",
}, &i18n.Message{
ID: "SearchTitle",
@@ -589,7 +589,7 @@ func addEnglish(i18nObject *i18n.Bundle) error {
ID: "TagsTitle",
Other: "Tags Tab",
}, &i18n.Message{
- ID: "Branch-CommitsTitle",
+ ID: "BranchCommitsTitle",
Other: "Commits Tab",
}, &i18n.Message{
ID: "MenuTitle",
@@ -601,10 +601,10 @@ func addEnglish(i18nObject *i18n.Bundle) error {
ID: "CredentialsTitle",
Other: "Credentials",
}, &i18n.Message{
- ID: "Remote-BranchesTitle",
+ ID: "RemoteBranchesTitle",
Other: "Remote Branches (in Remotes tab)",
}, &i18n.Message{
- ID: "Patch-BuildingTitle",
+ ID: "PatchBuildingTitle",
Other: "Patch Building",
}, &i18n.Message{
ID: "InformationTitle",
@@ -613,7 +613,7 @@ func addEnglish(i18nObject *i18n.Bundle) error {
ID: "SecondaryTitle",
Other: "Secondary",
}, &i18n.Message{
- ID: "Reflog-CommitsTitle",
+ ID: "ReflogCommitsTitle",
Other: "Reflog Tab",
}, &i18n.Message{
ID: "Title",
@@ -1272,6 +1272,15 @@ func addEnglish(i18nObject *i18n.Bundle) error {
}, &i18n.Message{
ID: "runningCommand",
Other: "running command",
+ }, &i18n.Message{
+ ID: "SubCommitsTitle",
+ Other: "Sub-commits",
+ }, &i18n.Message{
+ ID: "SubmodulesTitle",
+ Other: "Submodules",
+ }, &i18n.Message{
+ ID: "NavigationTitle",
+ Other: "List Panel Navigation",
},
)
}