diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-03-21 17:36:42 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-03-21 17:37:19 -0400 |
commit | f5bf4a93243c62b5b30ed0f1d15c124739444c79 (patch) | |
tree | 68edf4ecdd4d979ead71f712860d2bd2101c53c2 /config/bindings.go | |
parent | 79b459ecb0da7759de617d164cb1cafc4a6be1c8 (diff) |
Add context-specific keybindings
Diffstat (limited to 'config/bindings.go')
-rw-r--r-- | config/bindings.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/config/bindings.go b/config/bindings.go index 1882f74..0032d72 100644 --- a/config/bindings.go +++ b/config/bindings.go @@ -44,6 +44,16 @@ func NewKeyBindings() *KeyBindings { } } +func MergeBindings(bindings ...*KeyBindings) *KeyBindings { + merged := NewKeyBindings() + for _, b := range bindings { + merged.bindings = append(merged.bindings, b.bindings...) + } + merged.ExKey = bindings[0].ExKey + merged.Globals = bindings[0].Globals + return merged +} + func (bindings *KeyBindings) Add(binding *Binding) { // TODO: Search for conflicts? bindings.bindings = append(bindings.bindings, binding) |