feat: make keybindings configurable
This commit is contained in:
+6
-5
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user