1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-20 05:19:24 +02:00

reload config whenever returning to gui

This commit is contained in:
Jesse Duffield 2021-02-23 23:01:45 +11:00
parent a62d70fbd5
commit 043cb2ea44
2 changed files with 14 additions and 0 deletions

View File

@ -41,6 +41,7 @@ type AppConfigurer interface {
SaveAppState() error
SetIsNewRepo(bool)
GetIsNewRepo() bool
ReloadUserConfig() error
}
// NewAppConfig makes a new app config
@ -203,6 +204,16 @@ func (c *AppConfig) GetUserConfigDir() string {
return c.UserConfigDir
}
func (c *AppConfig) ReloadUserConfig() error {
userConfig, err := loadUserConfigWithDefaults(c.UserConfigDir)
if err != nil {
return err
}
c.UserConfig = userConfig
return nil
}
func configFilePath(filename string) (string, error) {
folder, err := findOrCreateConfigDir()
if err != nil {

View File

@ -464,6 +464,9 @@ func (gui *Gui) Run() error {
}
g.OnSearchEscape = gui.onSearchEscape
if err := gui.Config.ReloadUserConfig(); err != nil {
return nil
}
userConfig := gui.Config.GetUserConfig()
g.SearchEscapeKey = gui.getKey(userConfig.Keybinding.Universal.Return)
g.NextSearchMatchKey = gui.getKey(userConfig.Keybinding.Universal.NextMatch)