feat: make keybindings configurable

This commit is contained in:
Valdemar Lorenzen
2026-10-05 15:57:33 +02:00
parent 368442ba29
commit 3fd89fcbed
7 changed files with 466 additions and 137 deletions
+6 -5
View File
@@ -31,12 +31,13 @@ module Vamp
nil
end
def bind(key, command)
def bind(key, command, mode: "normal")
key = Vamp.string!(key, "binding key")
command = Vamp.string!(command, "binding command")
raise ArgumentError, "binding key must be one character" unless key.length == 1
raise ArgumentError, "binding command must not be empty" if command.empty?
@bindings << { "key" => key, "command" => command }
mode = Vamp.string!(mode, "binding mode")
command = Vamp.string!(command, "binding command") unless command.nil?
raise ArgumentError, "binding key must not be empty" if key.empty?
raise ArgumentError, "binding command must not be empty" if command == ""
@bindings << { "mode" => mode, "key" => key, "command" => command }
nil
end