summary refs log tree commit diff stats
path: root/config/bindings.go
diff options
context:
space:
mode:
Diffstat (limited to 'config/bindings.go')
-rw-r--r--config/bindings.go10
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)