"github.com/zyedidia/tcell"
)
-var Bindings = DefaultBindings()
-
func InitBindings() {
+ config.Bindings = DefaultBindings()
+
var parsed map[string]string
defaults := DefaultBindings()
util.TermMessage("Raw events not supported yet")
}
- Bindings[k] = v
+ config.Bindings[k] = v
}
// findKeyEvent will find binding Key 'b' using string 'k'
// see if the key is in bindingKeys with the Ctrl prefix.
k = string(unicode.ToUpper(rune(k[0]))) + k[1:]
if code, ok := keyEvents["Ctrl"+k]; ok {
+ var r tcell.Key
+ // Special case for escape, for some reason tcell doesn't send it with the esc character
+ if code < 256 && code != 27 {
+ r = code
+ }
// It is, we're done.
return KeyEvent{
code: code,
mod: modifiers,
- r: rune(code),
+ r: rune(r),
}, true
}
}
// See if we can find the key in bindingKeys
if code, ok := keyEvents[k]; ok {
+ var r tcell.Key
+ // Special case for escape, for some reason tcell doesn't send it with the esc character
+ if code < 256 && code != 27 {
+ r = code
+ }
return KeyEvent{
code: code,
mod: modifiers,
- r: 0,
+ r: rune(r),
}, true
}
"Backspace": "Backspace",
"Alt-CtrlH": "DeleteWordLeft",
"Alt-Backspace": "DeleteWordLeft",
- "Tab": "IndentSelection,InsertTab",
- "Backtab": "OutdentSelection,OutdentLine",
+ "Tab": "InsertTab",
+ "Backtab": "OutdentLine",
"CtrlO": "OpenFile",
"CtrlS": "Save",
"CtrlF": "Find",