summaryrefslogtreecommitdiffstats
path: root/pkg/gui
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-10-03 14:54:55 +1000
committerJesse Duffield <jessedduffield@gmail.com>2020-10-10 00:23:01 +1100
commit4912205adb5e8e245b33b8e0d5581bcf0ec37e8a (patch)
tree90e28657c0af72cd0a880842f88750c01a32834d /pkg/gui
parent9440dcf9de3214927125693e512cdc941ca4e123 (diff)
remove viper
WIP
Diffstat (limited to 'pkg/gui')
-rw-r--r--pkg/gui/arrangement.go6
-rw-r--r--pkg/gui/commit_message_panel.go4
-rw-r--r--pkg/gui/confirmation_panel.go14
-rw-r--r--pkg/gui/credentials_panel.go6
-rw-r--r--pkg/gui/custom_commands.go37
-rw-r--r--pkg/gui/files_panel.go25
-rw-r--r--pkg/gui/global_handlers.go6
-rw-r--r--pkg/gui/gui.go20
-rw-r--r--pkg/gui/keybindings.go401
-rw-r--r--pkg/gui/list_context.go20
-rw-r--r--pkg/gui/menu_panel.go8
-rw-r--r--pkg/gui/merge_panel.go12
-rw-r--r--pkg/gui/quitting.go4
-rw-r--r--pkg/gui/rebase_options_panel.go2
-rw-r--r--pkg/gui/searching.go10
-rw-r--r--pkg/gui/staging_panel.go2
-rw-r--r--pkg/gui/stash_panel.go4
-rw-r--r--pkg/gui/status_panel.go4
-rw-r--r--pkg/gui/updates.go2
-rw-r--r--pkg/gui/view_helpers.go12
20 files changed, 297 insertions, 302 deletions
diff --git a/pkg/gui/arrangement.go b/pkg/gui/arrangement.go
index 59fa87a01..6c7e3e067 100644
--- a/pkg/gui/arrangement.go
+++ b/pkg/gui/arrangement.go
@@ -42,7 +42,7 @@ func (gui *Gui) getMidSectionWeights() (int, int) {
currentWindow := gui.currentWindow()
// we originally specified this as a ratio i.e. .20 would correspond to a weight of 1 against 4
- sidePanelWidthRatio := gui.Config.GetUserConfig().GetFloat64("gui.sidePanelWidth")
+ sidePanelWidthRatio := gui.Config.GetUserConfig().Gui.SidePanelWidth
// we could make this better by creating ratios like 2:3 rather than always 1:something
mainSectionWeight := int(1/sidePanelWidthRatio) - 1
sideSectionWeight := 1
@@ -133,7 +133,7 @@ func (gui *Gui) getWindowDimensions(informationStr string, appStatus string) map
},
{
ConditionalDirection: func(width int, height int) int {
- mainPanelSplitMode := gui.Config.GetUserConfig().GetString("gui.mainPanelSplitMode")
+ mainPanelSplitMode := gui.Config.GetUserConfig().Gui.MainPanelSplitMode
switch mainPanelSplitMode {
case "vertical":
@@ -213,7 +213,7 @@ func (gui *Gui) sidePanelChildren(width int, height int) []*boxlayout.Box {
fullHeightBox("stash"),
}
} else if height >= 28 {
- accordianMode := gui.Config.GetUserConfig().GetBool("gui.expandFocusedSidePanel")
+ accordianMode := gui.Config.GetUserConfig().Gui.ExpandFocusedSidePanel
accordianBox := func(defaultBox *boxlayout.Box) *boxlayout.Box {
if accordianMode && defaultBox.Window == currentWindow {
return &boxlayout.Box{
diff --git a/pkg/gui/commit_message_panel.go b/pkg/gui/commit_message_panel.go
index 2f92a0882..3db714fa2 100644
--- a/pkg/gui/commit_message_panel.go
+++ b/pkg/gui/commit_message_panel.go
@@ -31,7 +31,7 @@ func (gui *Gui) handleCommitConfirm(g *gocui.Gui, v *gocui.View) error {
return gui.createErrorPanel(gui.Tr.SLocalize("CommitWithoutMessageErr"))
}
flags := ""
- skipHookPrefix := gui.Config.GetUserConfig().GetString("git.skipHookPrefix")
+ skipHookPrefix := gui.Config.GetUserConfig().Git.SkipHookPrefix
if skipHookPrefix != "" && strings.HasPrefix(message, skipHookPrefix) {
flags = "--no-verify"
}
@@ -71,7 +71,7 @@ func (gui *Gui) getBufferLength(view *gocui.View) string {
// RenderCommitLength is a function.
func (gui *Gui) RenderCommitLength() {
- if !gui.Config.GetUserConfig().GetBool("gui.commitLength.show") {
+ if !gui.Config.GetUserConfig().Gui.CommitLength.Show {
return
}
v := gui.getCommitMessageView()
diff --git a/pkg/gui/confirmation_panel.go b/pkg/gui/confirmation_panel.go
index 1035a2f0e..eabc57881 100644
--- a/pkg/gui/confirmation_panel.go
+++ b/pkg/gui/confirmation_panel.go
@@ -95,9 +95,10 @@ func (gui *Gui) wrappedPromptConfirmationFunction(handlersManageFocus bool, func
}
func (gui *Gui) deleteConfirmationView() {
- gui.g.DeleteKeybinding("confirmation", gui.getKey("universal.confirm"), gocui.ModNone)
- gui.g.DeleteKeybinding("confirmation", gui.getKey("universal.confirm-alt1"), gocui.ModNone)
- gui.g.DeleteKeybinding("confirmation", gui.getKey("universal.return"), gocui.ModNone)
+ keybindingConfig := gui.Config.GetUserConfig().Keybinding
+ _ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Confirm), gocui.ModNone)
+ _ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.ConfirmAlt1), gocui.ModNone)
+ _ = gui.g.DeleteKeybinding("confirmation", gui.getKey(keybindingConfig.Universal.Return), gocui.ModNone)
_ = gui.g.DeleteView("confirmation")
}
@@ -220,14 +221,15 @@ func (gui *Gui) setKeyBindings(opts createPopupPanelOpts) error {
onConfirm = gui.wrappedConfirmationFunction(opts.handlersManageFocus, opts.handleConfirm)
}
- if err := gui.g.SetKeybinding("confirmation", nil, gui.getKey("universal.confirm"), gocui.ModNone, onConfirm); err != nil {
+ keybindingConfig := gui.Config.GetUserConfig().Keybinding
+ if err := gui.g.SetKeybinding("confirmation", nil, gui.getKey(keybindingConfig.Universal.Confirm), gocui.ModNone, onConfirm); err != nil {
return err
}
- if err := gui.g.SetKeybinding("confirmation", nil, gui.getKey("universal.confirm-alt1"), gocui.ModNone, onConfirm); err != nil {
+ if err := gui.g.SetKeybinding("confirmation", nil, gui.getKey(keybindingConfig.Universal.ConfirmAlt1), gocui.ModNone, onConfirm); err != nil {
return err
}
- return gui.g.SetKeybinding("confirmation", nil, gui.getKey("universal.return"), gocui.ModNone, gui.wrappedConfirmationFunction(opts.handlersManageFocus, opts.handleClose))
+ return gui.g.SetKeybinding("confirmation", nil, gui.getKey(keybindingConfig.Universal.Return), gocui.ModNone, gui.wrappedConfirmationFunction(opts.handlersManageFocus, opts.handleClose))
}
func (gui *Gui) createErrorPanel(message string) error {
diff --git a/pkg/gui/credentials_panel.go b/pkg/gui/credentials_panel.go
index 903f72a1c..8620f7a23 100644
--- a/pkg/gui/credentials_panel.go
+++ b/pkg/gui/credentials_panel.go
@@ -51,11 +51,13 @@ func (gui *Gui) handleCloseCredentialsView(g *gocui.Gui, v *gocui.View) error {
}
func (gui *Gui) handleCredentialsViewFocused() error {
+ keybindingConfig := gui.Config.GetUserConfig().Keybinding
+
message := gui.Tr.TemplateLocalize(
"CloseConfirm",
Teml{
- "keyBindClose": gui.getKeyDisplay("universal.return"),
- "keyBindConfirm": gui.getKeyDisplay("universal.confirm"),
+ "keyBindClose": gui.getKeyDisplay(keybindingConfig.Universal.Return),
+ "keyBindConfirm": gui.getKeyDisplay(keybindingConfig.Universal.Confirm),
},
)
gui.renderString("options", message)
diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go
index 74a07e9d1..c4156852b 100644
--- a/pkg/gui/custom_commands.go
+++ b/pkg/gui/custom_commands.go
@@ -7,6 +7,7 @@ import (
"github.com/fatih/color"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands/models"
+ "github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@@ -44,7 +45,7 @@ func (gui *Gui) resolveTemplate(templateStr string, promptResponses []string) (s
return utils.ResolveTemplate(templateStr, objects)
}
-func (gui *Gui) handleCustomCommandKeybinding(customCommand CustomCommand) func() error {
+func (gui *Gui) handleCustomCommandKeybinding(customCommand config.CustomCommand) func() error {
return func() error {
promptResponses := make([]string, len(customCommand.Prompts))
@@ -161,41 +162,9 @@ func (gui *Gui) handleCustomCommandKeybinding(customCommand CustomCommand) func(
}
}
-type CustomCommandMenuOption struct {
- Name string `yaml:"name"`
- Description string `yaml:"description"`
- Value string `yaml:"value"`
-}
-
-type CustomCommandPrompt struct {
- Type string `yaml:"type"` // one of 'input' and 'menu'
- Title string `yaml:"title"`
-
- // this only apply to prompts
- InitialValue string `yaml:"initialValue"`
-
- // this only applies to menus
- Options []CustomCommandMenuOption
-}
-
-type CustomCommand struct {
- Key string `yaml:"key"`
- Context string `yaml:"context"`
- Command string `yaml:"command"`
- Subprocess bool `yaml:"subprocess"`
- Prompts []CustomCommandPrompt `yaml:"prompts"`
- LoadingText string `yaml:"loadingText"`
- Description string `yaml:"description"`
-}
-
func (gui *Gui) GetCustomCommandKeybindings() []*Binding {
bindings := []*Binding{}
-
- var customCommands []CustomCommand
-
- if err := gui.Config.GetUserConfig().UnmarshalKey("customCommands", &customCommands); err != nil {
- log.Fatalf("Error parsing custom command keybindings: %v", err)
- }
+ customCommands := gui.Config.GetUserConfig().CustomCommands
for _, customCommand := range customCommands {
var viewName string
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index 353c55c1b..798a13618 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -14,6 +14,7 @@ import (
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/models"
+ "github.com/jesseduffield/lazygit/pkg/config"
"github.com/jesseduffield/lazygit/pkg/utils"
"github.com/mgutz/str"
)
@@ -278,7 +279,7 @@ func (gui *Gui) handleIgnoreFile(g *gocui.Gui, v *gocui.View) error {
}
func (gui *Gui) handleWIPCommitPress(g *gocui.Gui, filesView *gocui.View) error {
- skipHookPreifx := gui.Config.GetUserConfig().GetString("git.skipHookPrefix")
+ skipHookPreifx := gui.Config.GetUserConfig().Git.SkipHookPrefix
if skipHookPreifx == "" {
return gui.createErrorPanel(gui.Tr.SLocalize("SkipHookPrefixNotConfigured"))
}
@@ -291,6 +292,15 @@ func (gui *Gui) handleWIPCommitPress(g *gocui.Gui, filesView *gocui.View) error
return gui.handleCommitPress()
}
+func (gui *Gui) commitPrefixConfigForRepo() *config.CommitPrefixConfig {
+ cfg, ok := gui.Config.GetUserConfig().Git.CommitPrefixes[utils.GetCurrentRepoName()]
+ if !ok {
+ return nil
+ }
+
+ return &cfg
+}
+
func (gui *Gui) handleCommitPress() error {
if len(gui.stagedFiles()) == 0 {
return gui.promptToStageAllAndRetry(func() error {
@@ -299,9 +309,10 @@ func (gui *Gui) handleCommitPress() error {
}
commitMessageView := gui.getCommitMessageView()
- prefixPattern := gui.Config.GetUserConfig().GetString("git.commitPrefixes." + utils.GetCurrentRepoName() + ".pattern")
- prefixReplace := gui.Config.GetUserConfig().GetString("git.commitPrefixes." + utils.GetCurrentRepoName() + ".replace")
- if len(prefixPattern) > 0 && len(prefixReplace) > 0 {
+ commitPrefixConfig := gui.commitPrefixConfigForRepo()
+ if commitPrefixConfig != nil {
+ prefixPattern := commitPrefixConfig.Pattern
+ prefixReplace := commitPrefixConfig.Replace
rgx, err := regexp.Compile(prefixPattern)
if err != nil {
return gui.createErrorPanel(fmt.Sprintf("%s: %s", gui.Tr.SLocalize("commitPrefixPatternError"), err.Error()))
@@ -498,7 +509,7 @@ func (gui *Gui) pullFiles(opts PullFilesOptions) error {
return err
}
- mode := gui.Config.GetUserConfig().GetString("git.pull.mode")
+ mode := gui.Config.GetUserConfig().Git.Pull.Mode
go gui.pullWithMode(mode, opts)
@@ -544,7 +555,7 @@ func (gui *Gui) pushWithForceFlag(v *gocui.View, force bool, upstream string, ar
branchName := gui.getCheckedOutBranch().Name
err := gui.GitCommand.Push(branchName, force, upstream, args, gui.promptUserForCredential)
if err != nil && !force && strings.Contains(err.Error(), "Updates were rejected") {
- forcePushDisabled := gui.Config.GetUserConfig().GetBool("git.disableForcePushing")
+ forcePushDisabled := gui.Config.GetUserConfig().Git.DisableForcePushing
if forcePushDisabled {
gui.createErrorPanel(gui.Tr.SLocalize("UpdatesRejectedAndForcePushDisabled"))
return
@@ -595,7 +606,7 @@ func (gui *Gui) pushFiles(g *gocui.Gui, v *gocui.View) error {
return gui.pushWithForceFlag(v, false, "", "")
}
- forcePushDisabled := gui.Config.GetUserConfig().GetBool("git.disableForcePushing")
+ forcePushDisabled := gui.Config.GetUserConfig().Git.DisableForcePushing
if forcePushDisabled {
return gui.createErrorPanel(gui.Tr.SLocalize("ForcePushDisabled"))
}
diff --git a/pkg/gui/global_handlers.go b/pkg/gui/global_handlers.go
index ddbb2e542..99fea388c 100644
--- a/pkg/gui/global_handlers.go
+++ b/pkg/gui/global_handlers.go
@@ -39,7 +39,7 @@ func (gui *Gui) scrollUpView(viewName string) error {
return nil
}
ox, oy := mainView.Origin()
- newOy := int(math.Max(0, float64(oy-gui.Config.GetUserConfig().GetInt("gui.scrollHeight"))))
+ newOy := int(math.Max(0, float64(oy-gui.Config.GetUserConfig().Gui.ScrollHeight)))
return mainView.SetOrigin(ox, newOy)
}
@@ -50,11 +50,11 @@ func (gui *Gui) scrollDownView(viewName string) error {
}
ox, oy := mainView.Origin()
y := oy
- if !gui.Config.GetUserConfig().GetBool("gui.scrollPastBottom") {
+ if !gui.Config.GetUserConfig().Gui.ScrollPastBottom {
_, sy := mainView.Size()
y += sy
}
- scrollHeight := gui.Config.GetUserConfig().GetInt("gui.scrollHeight")
+ scrollHeight := gui.Config.GetUserConfig().Gui.ScrollHeight
if y < mainView.LinesHeight() {
if err := mainView.SetOrigin(ox, oy+scrollHeight); err != nil {
return err
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index 06d79e12d..46861e72f 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -433,13 +433,14 @@ func (gui *Gui) Run() error {
}
g.OnSearchEscape = gui.onSearchEscape
- g.SearchEscapeKey = gui.getKey("universal.return")
- g.NextSearchMatchKey = gui.getKey("universal.nextMatch")
- g.PrevSearchMatchKey = gui.getKey("universal.prevMatch")
+ userConfig := gui.Config.GetUserConfig()
+ g.SearchEscapeKey = gui.getKey(userConfig.Keybinding.Universal.Return)
+ g.NextSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.NextMatch)
+ g.PrevSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.PrevMatch)
g.ASCII = runtime.GOOS == "windows" && runewidth.IsEastAsian()
- if gui.Config.GetUserConfig().GetBool("gui.mouseEvents") {
+ if userConfig.Gui.MouseEvents {
g.Mouse = true
}
@@ -450,7 +451,7 @@ func (gui *Gui) Run() error {
}
popupTasks := []func(chan struct{}) error{}
- configPopupVersion := gui.Config.GetUserConfig().GetInt("StartupPopupVersion")
+ configPopupVersion := gui.Config.GetUserConfig().StartupPopupVersion
// -1 means we've disabled these popups
if configPopupVersion != -1 && configPopupVersion < StartupPopupVersion {
popupTasks = append(popupTasks, gui.showIntroPopupMessage)
@@ -458,7 +459,7 @@ func (gui *Gui) Run() error {
gui.showInitialPopups(popupTasks)
gui.waitForIntro.Add(1)
- if gui.Config.GetUserConfig().GetBool("git.autoFetch") {
+ if gui.Config.GetUserConfig().Git.AutoFetch {
go gui.startBackgroundFetch()
}
@@ -572,7 +573,10 @@ func (gui *Gui) showInitialPopups(tasks []func(chan struct{}) error) {
func (gui *Gui) showIntroPopupMessage(done chan struct{}) error {
onConfirm := func() error {
done <- struct{}{}
- return gui.Config.WriteToUserConfig("startupPopupVersion", StartupPopupVersion)
+ return gui.Config.WriteToUserConfig(func(userConfig *config.UserConfig) error {
+ userConfig.StartupPopupVersion = StartupPopupVersion
+ return nil
+ })
}
return gui.ask(askOpts{
@@ -621,7 +625,7 @@ func (gui *Gui) startBackgroundFetch() {
// setColorScheme sets the color scheme for the app based on the user config
func (gui *Gui) setColorScheme() error {
userConfig := gui.Config.GetUserConfig()
- theme.UpdateTheme(userConfig)
+ theme.UpdateTheme(userConfig.Gui.Theme)
gui.g.FgColor = theme.InactiveBorderColor
gui.g.SelFgColor = theme.ActiveBorderColor
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(co