From db24b6377c67006b9f1578ef073f50180442933a Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 2 Apr 2019 08:29:10 -0300 Subject: Vim HJKL keybindings :) --- ui.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ui.js') diff --git a/ui.js b/ui.js index e78caa9..0be43e3 100644 --- a/ui.js +++ b/ui.js @@ -35,6 +35,17 @@ const { promisify } = require('util') const readFile = promisify(fs.readFile) const writeFile = promisify(fs.writeFile) +// Sneaky hack :) +const addKey = (prop, key) => { + const oldFunc = telc[prop] + telc[prop] = input => input.toString().toLowerCase() === key || oldFunc(input) +} + +addKey('isDown', 'j') +addKey('isUp', 'k') +addKey('isLeft', 'h') +addKey('isRight', 'l') + class AppElement extends FocusElement { constructor() { super() -- cgit 1.3.0-6-gf8a5