diff --git a/pkg/gui/custom_commands.go b/pkg/gui/custom_commands.go index 655e1771f..034dd3381 100644 --- a/pkg/gui/custom_commands.go +++ b/pkg/gui/custom_commands.go @@ -212,6 +212,7 @@ func (gui *Gui) GetCustomCommandKeybindings() []*Binding { for _, customCommand := range customCommands { var viewName string + var contexts []string switch customCommand.Context { case "global": viewName = "" @@ -226,11 +227,12 @@ func (gui *Gui) GetCustomCommandKeybindings() []*Binding { // Currently this is a safe bet but it's by no means guaranteed in the long term // and we might need to make some changes in the future to support it. viewName = context.GetViewName() + contexts = []string{customCommand.Context} } bindings = append(bindings, &Binding{ ViewName: viewName, - Contexts: []string{customCommand.Context}, + Contexts: contexts, Key: gui.getKey(customCommand.Key), Modifier: gocui.ModNone, Handler: gui.wrappedHandler(gui.handleCustomCommandKeybinding(customCommand)), diff --git a/pkg/gui/options_menu_panel.go b/pkg/gui/options_menu_panel.go index 5211d34ea..9027685a9 100644 --- a/pkg/gui/options_menu_panel.go +++ b/pkg/gui/options_menu_panel.go @@ -12,7 +12,7 @@ func (gui *Gui) getBindings(v *gocui.View) []*Binding { bindingsGlobal, bindingsPanel []*Binding ) - bindings := append(gui.GetInitialKeybindings(), gui.GetCustomCommandKeybindings()...) + bindings := append(gui.GetCustomCommandKeybindings(), gui.GetInitialKeybindings()...) for _, binding := range bindings { if GetKeyDisplay(binding.Key) != "" && binding.Description != "" {