diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-03 14:54:55 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-10 00:23:01 +1100 |
commit | 4912205adb5e8e245b33b8e0d5581bcf0ec37e8a (patch) | |
tree | 90e28657c0af72cd0a880842f88750c01a32834d /pkg/gui/keybindings.go | |
parent | 9440dcf9de3214927125693e512cdc941ca4e123 (diff) |
remove viper
WIP
Diffstat (limited to 'pkg/gui/keybindings.go')
-rw-r--r-- | pkg/gui/keybindings.go | 401 |
1 files changed, 199 insertions, 202 deletions
diff --git a/pkg/gui/keybindings.go b/pkg/gui/keybindings.go index 184314a3f..f6d0363b6 100644 --- a/pkg/gui/keybindings.go +++ b/pkg/gui/keybindings.go @@ -180,131 +180,128 @@ func GetKeyDisplay(key interface{}) string { return fmt.Sprintf("%c", keyInt) } -func (gui *Gui) getKey(name string) interface{} { - key := gui.Config.GetUserConfig().GetString("keybinding." + name) - if key == "" { - // if we don't have the keybinding in our local config we'll assume it's just a plain letter from a custom command - key = name - } +func (gui *Gui) getKey(key string) interface{} { runeCount := utf8.RuneCountInString(key) if runeCount > 1 { binding := keymap[strings.ToLower(key)] if binding == nil { - log.Fatalf("Unrecognized key %s for keybinding %s. For permitted values see https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings/Custom_Keybindings.md", strings.ToLower(key), name) + log.Fatalf("Unrecognized key %s for keybinding. For permitted values see https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings/Custom_Keybindings.md", strings.ToLower(key)) } else { return binding } } else if runeCount == 1 { return []rune(key)[0] } - log.Fatal("Key empty for keybinding: " + strings.ToLower(name)) + log.Fatal("Key empty for keybinding: " + strings.ToLower(key)) return nil } // GetInitialKeybindings is a function. func (gui *Gui) GetInitialKeybindings() []*Binding { + config := gui.Config.GetUserConfig().Keybinding + bindings := []*Binding{ { ViewName: "", - Key: gui.getKey("universal.quit"), + Key: gui.getKey(config.Universal.Quit), Modifier: gocui.ModNone, Handler: gui.wrappedHandler(gui.handleQuit), }, { ViewName: "", - Key: gui.getKey("universal.quitWithoutChangingDirectory"), + Key: gui.getKey(config.Universal.QuitWithoutChangingDirectory), Modifier: gocui.ModNone, Handler: gui.handleQuitWithoutChangingDirectory, }, { ViewName: "", - Key: gui.getKey("universal.quit-alt1"), + Key: gui.getKey(config.Universal.QuitAlt1), Modifier: gocui.ModNone, Handler: gui.wrappedHandler(gui.handleQuit), }, { ViewName: "", - Key: gui.getKey("universal.return"), + Key: gui.getKey(config.Universal.Return), Modifier: gocui.ModNone, Handler: gui.handleTopLevelReturn, }, { ViewName: "", - Key: gui.getKey("universal.scrollUpMain"), + Key: gui.getKey(config.Universal.ScrollUpMain), Handler: gui.scrollUpMain, Alternative: "fn+up", Description: gui.Tr.SLocalize("scrollUpMainPanel"), }, { ViewName: "", - Key: gui.getKey("universal.scrollDownMain"), + Key: gui.getKey(config.Universal.ScrollDownMain), Handler: gui.scrollDownMain, Alternative: "fn+down", Description: gui.Tr.SLocalize("scrollDownMainPanel"), }, { ViewName: "", - Key: gui.getKey("universal.scrollUpMain-alt1"), + Key: gui.getKey(config.Universal.ScrollUpMainAlt1), Modifier: gocui.ModNone, Handler: gui.scrollUpMain, }, { ViewName: "", - Key: gui.getKey("universal.scrollDownMain-alt1"), + Key: gui.getKey(config.Universal.ScrollDownMainAlt1), Modifier: gocui.ModNone, Handler: gui.scrollDownMain, }, { ViewName: "", - Key: gui.getKey("universal.scrollUpMain-alt2"), + Key: gui.getKey(config.Universal.ScrollUpMainAlt2), Modifier: gocui.ModNone, Handler: gui.scrollUpMain, }, { ViewName: "", - Key: gui.getKey("universal.scrollDownMain-alt2"), + Key: gui.getKey(config.Universal.ScrollDownMainAlt2), Modifier: gocui.ModNone, Handler: gui.scrollDownMain, }, { ViewName: "", - Key: gui.getKey("universal.createRebaseOptionsMenu"), + Key: gui.getKey(config.Universal.CreateRebaseOptionsMenu), Handler: gui.wrappedHandler(gui.handleCreateRebaseOptionsMenu), Description: gui.Tr.SLocalize("ViewMergeRebaseOptions"), }, { ViewName: "", - Key: gui.getKey("universal.createPatchOptionsMenu"), + Key: gui.getKey(config.Universal.CreatePatchOptionsMenu), Handler: gui.handleCreatePatchOptionsMenu, Description: gui.Tr.SLocalize("ViewPatchOptions"), }, { ViewName: "", - Key: gui.getKey("universal.pushFiles"), + Key: gui.getKey(config.Universal.PushFiles), Handler: gui.pushFiles, Description: gui.Tr.SLocalize("push"), }, { ViewName: "", - Key: gui.getKey("universal.pullFiles"), + Key: gui.getKey(config.Universal.PullFiles), Handler: gui.handlePullFiles, Description: gui.Tr.SLocalize("pull"), }, { ViewName: "", - Key: gui.getKey("universal.refresh"), + Key: gui.getKey(config.Universal.Refresh), Handler: gui.handleRefresh, Description: gui.Tr.SLocalize("refresh"), }, { ViewName: "", - Key: gui.getKey("universal.optionMenu"), + Key: gui.getKey(config.Universal.OptionMenu), Handler: gui.handleCreateOptionsMenu, Description: gui.Tr.SLocalize("openMenu"), }, { ViewName: "", - Key: gui.getKey("universal.optionMenu-alt1"), + Key: gui.getKey(config.Universal.OptionMenuAlt1), Modifier: gocui.ModNone, Handler: gui.handleCreateOptionsMenu, }, @@ -316,496 +313,496 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { }, { ViewName: "", - Key: gui.getKey("universal.undo"), + Key: gui.getKey(config.Universal.Undo), Handler: gui.reflogUndo, Description: gui.Tr.SLocalize("undoReflog"), }, { ViewName: "", - Key: gui.getKey("universal.redo"), + Key: gui.getKey(config.Universal.Redo), Handler: gui.reflogRedo, Description: gui.Tr.SLocalize("redoReflog"), }, { ViewName: "status", - Key: gui.getKey("universal.edit"), + Key: gui.getKey(config.Universal.Edit), Handler: gui.handleEditConfig, Description: gui.Tr.SLocalize("EditConfig"), }, { ViewName: "", - Key: gui.getKey("universal.nextScreenMode"), + Key: gui.getKey(config.Universal.NextScreenMode), Handler: gui.nextScreenMode, Description: gui.Tr.SLocalize("nextScreenMode"), }, { ViewName: "", - Key: gui.getKey("universal.prevScreenMode"), + Key: gui.getKey(config.Universal.PrevScreenMode), Handler: gui.prevScreenMode, Description: gui.Tr.SLocalize("prevScreenMode"), }, { ViewName: "status", - Key: gui.getKey("universal.openFile"), + Key: gui.getKey(config.Universal.OpenFile), Handler: gui.handleOpenConfig, Description: gui.Tr.SLocalize("OpenConfig"), }, { ViewName: "status", - Key: gui.getKey("status.checkForUpdate"), + Key: gui.getKey(config.Status.CheckForUpdate), Handler: gui.handleCheckForUpdate, Description: gui.Tr.SLocalize("checkForUpdate"), }, { ViewName: "status", - Key: gui.getKey("status.recentRepos"), + Key: gui.getKey(config.Status.RecentRepos), Handler: gui.wrappedHandler(gui.handleCreateRecentReposMenu), Description: gui.Tr.SLocalize("SwitchRepo"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.commitChanges"), + Key: gui.getKey(config.Files.CommitChanges), Handler: gui.wrappedHandler(gui.handleCommitPress), Description: gui.Tr.SLocalize("CommitChanges"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.commitChangesWithoutHook"), + Key: gui.getKey(config.Files.CommitChangesWithoutHook), Handler: gui.handleWIPCommitPress, Description: gui.Tr.SLocalize("commitChangesWithoutHook"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.amendLastCommit"), + Key: gui.getKey(config.Files.AmendLastCommit), Handler: gui.wrappedHandler(gui.handleAmendCommitPress), Description: gui.Tr.SLocalize("AmendLastCommit"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.commitChangesWithEditor"), + Key: gui.getKey(config.Files.CommitChangesWithEditor), Handler: gui.wrappedHandler(gui.handleCommitEditorPress), Description: gui.Tr.SLocalize("CommitChangesWithEditor"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("universal.select"), + Key: gui.getKey(config.Universal.Select), Handler: gui.wrappedHandler(gui.handleFilePress), Description: gui.Tr.SLocalize("toggleStaged"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("universal.remove"), + Key: gui.getKey(config.Universal.Remove), Handler: gui.handleCreateDiscardMenu, Description: gui.Tr.SLocalize("viewDiscardOptions"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("universal.edit"), + Key: gui.getKey(config.Universal.Edit), Handler: gui.handleFileEdit, Description: gui.Tr.SLocalize("editFile"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("universal.openFile"), + Key: gui.getKey(config.Universal.OpenFile), Handler: gui.handleFileOpen, Description: gui.Tr.SLocalize("openFile"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.ignoreFile"), + Key: gui.getKey(config.Files.IgnoreFile), Handler: gui.handleIgnoreFile, Description: gui.Tr.SLocalize("ignoreFile"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.refreshFiles"), + Key: gui.getKey(config.Files.RefreshFiles), Handler: gui.handleRefreshFiles, Description: gui.Tr.SLocalize("refreshFiles"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.stashAllChanges"), + Key: gui.getKey(config.Files.StashAllChanges), Handler: gui.handleStashChanges, Description: gui.Tr.SLocalize("stashAllChanges"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.viewStashOptions"), + Key: gui.getKey(config.Files.ViewStashOptions), Handler: gui.handleCreateStashMenu, Description: gui.Tr.SLocalize("viewStashOptions"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.toggleStagedAll"), + Key: gui.getKey(config.Files.ToggleStagedAll), Handler: gui.handleStageAll, Description: gui.Tr.SLocalize("toggleStagedAll"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.viewResetOptions"), + Key: gui.getKey(config.Files.ViewResetOptions), Handler: gui.handleCreateResetMenu, Description: gui.Tr.SLocalize("viewResetOptions"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("universal.goInto"), + Key: gui.getKey(config.Universal.GoInto), Handler: gui.handleEnterFile, Description: gui.Tr.SLocalize("StageLines"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("files.fetch"), + Key: gui.getKey(config.Files.Fetch), Handler: gui.handleGitFetch, Description: gui.Tr.SLocalize("fetch"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("universal.copyToClipboard"), + Key: gui.getKey(config.Universal.CopyToClipboard), Handler: gui.wrappedHandler(gui.handleCopySelectedSideContextItemToClipboard), Description: gui.Tr.SLocalize("copyFileNameToClipboard"), }, { ViewName: "", - Key: gui.getKey("universal.executeCustomCommand"), + Key: gui.getKey(config.Universal.ExecuteCustomCommand), Handler: gui.handleCustomCommand, Description: gui.Tr.SLocalize("executeCustomCommand"), }, { ViewName: "files", Contexts: []string{FILES_CONTEXT_KEY}, - Key: gui.getKey("commits.viewResetOptions"), + Key: gui.getKey(config.Commits.ViewResetOptions), Handler: gui.handleCreateResetToUpstreamMenu, Description: gui.Tr.SLocalize("viewResetToUpstreamOptions"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("universal.select"), + Key: gui.getKey(config.Universal.Select), Handler: gui.handleBranchPress, Description: gui.Tr.SLocalize("checkout"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("branches.createPullRequest"), + Key: gui.getKey(config.Branches.CreatePullRequest), Handler: gui.handleCreatePullRequestPress, Description: gui.Tr.SLocalize("createPullRequest"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("branches.checkoutBranchByName"), + Key: gui.getKey(config.Branches.CheckoutBranchByName), Handler: gui.handleCheckoutByName, Description: gui.Tr.SLocalize("checkoutByName"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("branches.forceCheckoutBranch"), + Key: gui.getKey(config.Branches.ForceCheckoutBranch), Handler: gui.handleForceCheckout, Description: gui.Tr.SLocalize("forceCheckout"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("universal.new"), + Key: gui.getKey(config.Universal.New), Handler: gui.wrappedHandler(gui.handleNewBranchOffCurrentItem), Description: gui.Tr.SLocalize("newBranch"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("universal.remove"), + Key: gui.getKey(config.Universal.Remove), Handler: gui.handleDeleteBranch, Description: gui.Tr.SLocalize("deleteBranch"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("branches.rebaseBranch"), + Key: gui.getKey(config.Branches.RebaseBranch), Handler: gui.handleRebaseOntoLocalBranch, Description: gui.Tr.SLocalize("rebaseBranch"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("branches.mergeIntoCurrentBranch"), + Key: gui.getKey(config.Branches.MergeIntoCurrentBranch), Handler: gui.handleMerge, Description: gui.Tr.SLocalize("mergeIntoCurrentBranch"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("branches.viewGitFlowOptions"), + Key: gui.getKey(config.Branches.ViewGitFlowOptions), Handler: gui.handleCreateGitFlowMenu, Description: gui.Tr.SLocalize("gitFlowOptions"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("branches.FastForward"), + Key: gui.getKey(config.Branches.FastForward), Handler: gui.handleFastForward, Description: gui.Tr.SLocalize("FastForward"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("commits.viewResetOptions"), + Key: gui.getKey(config.Commits.ViewResetOptions), Handler: gui.handleCreateResetToBranchMenu, Description: gui.Tr.SLocalize("viewResetOptions"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("branches.renameBranch"), + Key: gui.getKey(config.Branches.RenameBranch), Handler: gui.handleRenameBranch, Description: gui.Tr.SLocalize("renameBranch"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("universal.copyToClipboard"), + Key: gui.getKey(config.Universal.CopyToClipboard), Handler: gui.wrappedHandler(gui.handleCopySelectedSideContextItemToClipboard), Description: gui.Tr.SLocalize("copyBranchNameToClipboard"), }, { ViewName: "branches", Contexts: []string{LOCAL_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("universal.goInto"), + Key: gui.getKey(config.Universal.GoInto), Handler: gui.wrappedHandler(gui.handleSwitchToSubCommits), Description: gui.Tr.SLocalize("viewCommits"), }, { ViewName: "branches", Contexts: []string{TAGS_CONTEXT_KEY}, - Key: gui.getKey("universal.select"), + Key: gui.getKey(config.Universal.Select), Handler: gui.handleCheckoutTag, Description: gui.Tr.SLocalize("checkout"), }, { ViewName: "branches", Contexts: []string{TAGS_CONTEXT_KEY}, - Key: gui.getKey("universal.remove"), + Key: gui.getKey(config.Universal.Remove), Handler: gui.handleDeleteTag, Description: gui.Tr.SLocalize("deleteTag"), }, { ViewName: "branches", Contexts: []string{TAGS_CONTEXT_KEY}, - Key: gui.getKey("branches.pushTag"), + Key: gui.getKey(config.Branches.PushTag), Handler: gui.handlePushTag, Description: gui.Tr.SLocalize("pushTag"), }, { ViewName: "branches", Contexts: []string{TAGS_CONTEXT_KEY}, - Key: gui.getKey("universal.new"), + Key: gui.getKey(config.Universal.New), Handler: gui.handleCreateTag, Description: gui.Tr.SLocalize("createTag"), }, { ViewName: "branches", Contexts: []string{TAGS_CONTEXT_KEY}, - Key: gui.getKey("commits.viewResetOptions"), + Key: gui.getKey(config.Commits.ViewResetOptions), Handler: gui.handleCreateResetToTagMenu, Description: gui.Tr.SLocalize("viewResetOptions"), }, { ViewName: "branches", Contexts: []string{TAGS_CONTEXT_KEY}, - Key: gui.getKey("universal.goInto"), + Key: gui.getKey(config.Universal.GoInto), Handler: gui.wrappedHandler(gui.handleSwitchToSubCommits), Description: gui.Tr.SLocalize("viewCommits"), }, { ViewName: "branches", Contexts: []string{REMOTE_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("universal.return"), + Key: gui.getKey(config.Universal.Return), Handler: gui.handleRemoteBranchesEscape, Description: gui.Tr.SLocalize("ReturnToRemotesList"), }, { ViewName: "branches", Contexts: []string{REMOTE_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("commits.viewResetOptions"), + Key: gui.getKey(config.Commits.ViewResetOptions), Handler: gui.handleCreateResetToRemoteBranchMenu, Description: gui.Tr.SLocalize("viewResetOptions"), }, { ViewName: "branches", Contexts: []string{REMOTE_BRANCHES_CONTEXT_KEY}, - Key: gui.getKey("universal.goInto"), + Key: gui.getKey(config.Universal.GoInto), Handler: gui.wrappedHandler(gui.handleSwitchToSubCommits), Description: gui.Tr.SLocalize("viewCommits"), }, { ViewName: "branches", Contexts: []string{REMOTES_CONTEXT_KEY}, - Key: gui.getKey("branches.fetchRemote"), + Key: gui.getKey(config.Branches.FetchRemote), Handler: gui.handleFetchRemote, Description: gui.Tr.SLocalize("fetchRemote"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.squashDown"), + Key: gui.getKey(config.Commits.SquashDown), Handler: gui.handleCommitSquashDown, Description: gui.Tr.SLocalize("squashDown"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.renameCommit"), + Key: gui.getKey(config.Commits.RenameCommit), Handler: gui.handleRenameCommit, Description: gui.Tr.SLocalize("renameCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.renameCommitWithEditor"), + Key: gui.getKey(config.Commits.RenameCommitWithEditor), Handler: gui.handleRenameCommitEditor, Description: gui.Tr.SLocalize("renameCommitEditor"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.viewResetOptions"), + Key: gui.getKey(config.Commits.ViewResetOptions), Handler: gui.handleCreateCommitResetMenu, Description: gui.Tr.SLocalize("resetToThisCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.markCommitAsFixup"), + Key: gui.getKey(config.Commits.MarkCommitAsFixup), Handler: gui.handleCommitFixup, Description: gui.Tr.SLocalize("fixupCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.createFixupCommit"), + Key: gui.getKey(config.Commits.CreateFixupCommit), Handler: gui.handleCreateFixupCommit, Description: gui.Tr.SLocalize("createFixupCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.squashAboveCommits"), + Key: gui.getKey(config.Commits.SquashAboveCommits), Handler: gui.handleSquashAllAboveFixupCommits, Description: gui.Tr.SLocalize("squashAboveCommits"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.remove"), + Key: gui.getKey(config.Universal.Remove), Handler: gui.handleCommitDelete, Description: gui.Tr.SLocalize("deleteCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.moveDownCommit"), + Key: gui.getKey(config.Commits.MoveDownCommit), Handler: gui.handleCommitMoveDown, Description: gui.Tr.SLocalize("moveDownCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.moveUpCommit"), + Key: gui.getKey(config.Commits.MoveUpCommit), Handler: gui.handleCommitMoveUp, Description: gui.Tr.SLocalize("moveUpCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.edit"), + Key: gui.getKey(config.Universal.Edit), Handler: gui.handleCommitEdit, Description: gui.Tr.SLocalize("editCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.amendToCommit"), + Key: gui.getKey(config.Commits.AmendToCommit), Handler: gui.handleCommitAmendTo, Description: gui.Tr.SLocalize("amendToCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.pickCommit"), + Key: gui.getKey(config.Commits.PickCommit), Handler: gui.handleCommitPick, Description: gui.Tr.SLocalize("pickCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.revertCommit"), + Key: gui.getKey(config.Commits.RevertCommit), Handler: gui.handleCommitRevert, Description: gui.Tr.SLocalize("revertCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.cherryPickCopy"), + Key: gui.getKey(config.Commits.CherryPickCopy), Handler: gui.wrappedHandler(gui.handleCopyCommit), Description: gui.Tr.SLocalize("cherryPickCopy"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.copyToClipboard"), + Key: gui.getKey(config.Universal.CopyToClipboard), Handler: gui.wrappedHandler(gui.handleCopySelectedSideContextItemToClipboard), Description: gui.Tr.SLocalize("copyCommitShaToClipboard"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.cherryPickCopyRange"), + Key: gui.getKey(config.Commits.CherryPickCopyRange), Handler: gui.wrappedHandler(gui.handleCopyCommitRange), Description: gui.Tr.SLocalize("cherryPickCopyRange"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.pasteCommits"), + Key: gui.getKey(config.Commits.PasteCommits), Handler: gui.wrappedHandler(gui.HandlePasteCommits), Description: gui.Tr.SLocalize("pasteCommits"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.goInto"), + Key: gui.getKey(config.Universal.GoInto), Handler: gui.wrappedHandler(gui.handleViewCommitFiles), Description: gui.Tr.SLocalize("viewCommitFiles"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.checkoutCommit"), + Key: gui.getKey(config.Commits.CheckoutCommit), Handler: gui.handleCheckoutCommit, Description: gui.Tr.SLocalize("checkoutCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.new"), + Key: gui.getKey(config.Universal.New), Modifier: gocui.ModNone, Handler: gui.wrappedHandler(gui.handleNewBranchOffCurrentItem), Description: gui.Tr.SLocalize("createNewBranchFromCommit"), @@ -813,185 +810,185 @@ func (gui *Gui) GetInitialKeybindings() []*Binding { { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.tagCommit"), + Key: gui.getKey(config.Commits.TagCommit), Handler: gui.handleTagCommit, Description: gui.Tr.SLocalize("tagCommit"), }, { ViewName: "commits", Contexts: []string{BRANCH_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.resetCherryPick"), + Key: gui.getKey(config.Commits.ResetCherryPick), Handler: gui.wrappedHandler(gui.exitCherryPickingMode), Description: gui.Tr.SLocalize("resetCherryPick"), }, { ViewName: "commits", Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.goInto"), + Key: gui.getKey(config.Universal.GoInto), Handler: gui.wrappedHandler(gui.handleViewReflogCommitFiles), Description: gui.Tr.SLocalize("viewCommitFiles"), }, { ViewName: "commits", Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.select"), + Key: gui.getKey(config.Universal.Select), Handler: gui.handleCheckoutReflogCommit, Description: gui.Tr.SLocalize("checkoutCommit"), }, { ViewName: "commits", Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.viewResetOptions"), + Key: gui.getKey(config.Commits.ViewResetOptions), Handler: gui.handleCreateReflogResetMenu, Description: gui.Tr.SLocalize("viewResetOptions"), }, { ViewName: "commits", Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.cherryPickCopy"), + Key: gui.getKey(config.Commits.CherryPickCopy), Handler: gui.wrappedHandler(gui.handleCopyCommit), Description: gui.Tr.SLocalize("cherryPickCopy"), }, { ViewName: "commits", Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.cherryPickCopyRange"), + Key: gui.getKey(config.Commits.CherryPickCopyRange), Handler: gui.wrappedHandler(gui.handleCopyCommitRange), Description: gui.Tr.SLocalize("cherryPickCopyRange"), }, { ViewName: "commits", Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.resetCherryPick"), + Key: gui.getKey(config.Commits.ResetCherryPick), Handler: gui.wrappedHandler(gui.exitCherryPickingMode), Description: gui.Tr.SLocalize("resetCherryPick"), }, { ViewName: "commits", Contexts: []string{REFLOG_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.copyToClipboard"), + Key: gui.getKey(config.Universal.CopyToClipboard), Handler: gui.wrappedHandler(gui.handleCopySelectedSideContextItemToClipboard), Description: gui.Tr.SLocalize("copyCommitShaToClipboard"), }, { ViewName: "commitFiles", - Key: gui.getKey("universal.copyToClipboard"), + Key: gui.getKey(config.Universal.CopyToClipboard), Handler: gui.wrappedHandler(gui.handleCopySelectedSideContextItemToClipboard), Description: gui.Tr.SLocalize("copyCommitFileNameToClipboard"), }, { ViewName: "branches", Contexts: []string{SUB_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.goInto"), + Key: gui.getKey(config.Universal.GoInto), Handler: gui.wrappedHandler(gui.handleViewSubCommitFiles), Description: gui.Tr.SLocalize("viewCommitFiles"), }, { ViewName: "branches", Contexts: []string{SUB_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.select"), + Key: gui.getKey(config.Universal.Select), Handler: gui.handleCheckoutSubCommit, Description: gui.Tr.SLocalize("checkoutCommit"), }, { ViewName: "branches", Contexts: []string{SUB_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.viewResetOptions"), + Key: gui.getKey(config.Commits.ViewResetOptions), Handler: gui.wrappedHandler(gui.handleCreateSubCommitResetMenu), Description: gui.Tr.SLocalize("viewResetOptions"), }, { ViewName: "branches", Contexts: []string{SUB_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.new"), + Key: gui.getKey(config.Universal.New), Handler: gui.wrappedHandler(gui.handleNewBranchOffCurrentItem), Description: gui.Tr.SLocalize("newBranch"), }, { ViewName: "branches", Contexts: []string{SUB_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.cherryPickCopy"), + Key: gui.getKey(config.Commits.CherryPickCopy), Handler: gui.wrappedHandler(gui.handleCopyCommit), Description: gui.Tr.SLocalize("cherryPickCopy"), }, { ViewName: "branches", Contexts: []string{SUB_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.cherryPickCopyRange"), + Key: gui.getKey(config.Commits.CherryPickCopyRange), Handler: gui.wrappedHandler(gui.handleCopyCommitRange), Description: gui.Tr.SLocalize("cherryPickCopyRange"), }, { ViewName: "branches", Contexts: []string{SUB_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("commits.resetCherryPick"), + Key: gui.getKey(config.Commits.ResetCherryPick), Handler: gui.wrappedHandler(gui.exitCherryPickingMode), Description: gui.Tr.SLocalize("resetCherryPick"), }, { ViewName: "branches", Contexts: []string{SUB_COMMITS_CONTEXT_KEY}, - Key: gui.getKey("universal.copyToClipboard"), + Key: gui.getKey(config.Universal.CopyToClipboard), Handler: gui.wrappedHandler(gui.handleCopySelectedSideContextItemToClipboard), Description: gui.Tr.SLocalize("copyCommitShaToClipboard"), }, { ViewName: "stash", - Key: gui.getKey("universal.goInto"), + Key: gui.getKey(config.Universal.GoInto), Handler: gui.wrappedHandler(gui.handleViewStashFiles), Description: gui.Tr.SLocalize("viewStashFiles"), }, { ViewName: "stash", - Key: gui.getKey("universal.select"), + Key: gui.getKey(config.Universal.Select), Handler: gui.handleStashApply, Description: gui.Tr.SLocalize("apply"), }, { ViewName: "stash", - Key: gui.getKey("stash.popStash"), + Key: gui.getKey(config.Stash.PopStash), Handler: gui.handleStashPop, |