diff --git a/kittens/diff/main.go b/kittens/diff/main.go index d5ca9798b..653bb294e 100644 --- a/kittens/diff/main.go +++ b/kittens/diff/main.go @@ -28,6 +28,7 @@ func load_config(opts *Options) (ans *Config, err error) { if err != nil { return nil, err } + ans.KeyboardShortcuts = config.ResolveShortcuts(ans.KeyboardShortcuts) return ans, nil } diff --git a/tools/config/utils.go b/tools/config/utils.go index 75190afd4..8fc3a650a 100644 --- a/tools/config/utils.go +++ b/tools/config/utils.go @@ -9,6 +9,8 @@ import ( "regexp" "strconv" "strings" + + "golang.org/x/exp/maps" ) var _ = fmt.Print @@ -288,3 +290,16 @@ func (self *ShortcutTracker) Match(ev *loop.KeyEvent, all_actions []*KeyAction) } return nil } + +func ResolveShortcuts(actions []*KeyAction) []*KeyAction { + action_map := make(map[string]*KeyAction, len(actions)) + for _, ac := range actions { + key := strings.Join(ac.Normalized_keys, "\x00") + if ac.Name == "no_op" || ac.Name == "no-op" { + delete(action_map, key) + } else { + action_map[key] = ac + } + } + return maps.Values(action_map) +}