From f5bf4a93243c62b5b30ed0f1d15c124739444c79 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 21 Mar 2019 17:36:42 -0400 Subject: Add context-specific keybindings --- config/bindings.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'config/bindings.go') 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) -- cgit 1.4.1-2-gfad0