MCPcopy
hub / github.com/jesseduffield/lazygit / onUserConfigLoaded

Method onUserConfigLoaded

pkg/gui/gui.go:459–512  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

457}
458
459func (gui *Gui) onUserConfigLoaded() error {
460 userConfig := gui.Config.GetUserConfig()
461 gui.Common.SetUserConfig(userConfig)
462
463 if gui.previousLanguageConfig != userConfig.Gui.Language {
464 tr, err := i18n.NewTranslationSetFromConfig(gui.Log, userConfig.Gui.Language)
465 if err != nil {
466 return err
467 }
468 gui.c.Tr = tr
469 gui.previousLanguageConfig = userConfig.Gui.Language
470 }
471
472 gui.setColorScheme()
473 gui.configureViewProperties()
474
475 gui.g.SearchEscapeKeys = config.GetValidatedKeyBindingKeys(userConfig.Keybinding.Universal.Return)
476 gui.g.NextSearchMatchKeys = config.GetValidatedKeyBindingKeys(userConfig.Keybinding.Universal.NextMatch)
477 gui.g.PrevSearchMatchKeys = config.GetValidatedKeyBindingKeys(userConfig.Keybinding.Universal.PrevMatch)
478
479 gui.g.SetEditKeybindings(
480 config.GetValidatedKeyBindingKeys(userConfig.Keybinding.Universal.MoveWordLeft),
481 config.GetValidatedKeyBindingKeys(userConfig.Keybinding.Universal.MoveWordRight),
482 config.GetValidatedKeyBindingKeys(userConfig.Keybinding.Universal.BackspaceWord),
483 config.GetValidatedKeyBindingKeys(userConfig.Keybinding.Universal.ForwardDeleteWord),
484 )
485
486 gui.g.ShowListFooter = userConfig.Gui.ShowListFooter
487
488 gui.g.Mouse = userConfig.Gui.MouseEvents
489
490 // originally we could only hide the command log permanently via the config
491 // but now we do it via state. So we need to still support the config for the
492 // sake of backwards compatibility. We're making use of short circuiting here
493 gui.ShowExtrasWindow = userConfig.Gui.ShowCommandLog && !gui.c.GetAppState().HideCommandLog
494
495 authors.SetCustomAuthors(userConfig.Gui.AuthorColors)
496 if userConfig.Gui.NerdFontsVersion != "" {
497 icons.SetNerdFontsVersion(userConfig.Gui.NerdFontsVersion)
498 } else if userConfig.Gui.ShowIcons {
499 icons.SetNerdFontsVersion("2")
500 } else {
501 icons.SetNerdFontsVersion("")
502 }
503
504 if len(userConfig.Gui.BranchColorPatterns) > 0 {
505 presentation.SetCustomBranches(userConfig.Gui.BranchColorPatterns, true)
506 } else {
507 // Fall back to the deprecated branchColors config
508 presentation.SetCustomBranches(userConfig.Gui.BranchColors, false)
509 }
510
511 return nil
512}
513
514func (gui *Gui) checkForChangedConfigsThatDontAutoReload(oldConfig *config.UserConfig, newConfig *config.UserConfig) error {
515 configsThatDontAutoReload := []string{

Callers 1

onNewRepoMethod · 0.95

Calls 11

setColorSchemeMethod · 0.95
SetCustomAuthorsFunction · 0.92
SetNerdFontsVersionFunction · 0.92
SetCustomBranchesFunction · 0.92
SetUserConfigMethod · 0.80
SetEditKeybindingsMethod · 0.80
GetUserConfigMethod · 0.65
GetAppStateMethod · 0.65

Tested by

no test coverage detected