alexherbo2 / krabby

A keyboard interface to the web, inspired by Kakoune
https://krabby.netlify.app
The Unlicense
311 stars 20 forks source link

how to set Hint keyMap #21

Closed aecepoglu closed 4 years ago

aecepoglu commented 4 years ago

the keyMap for instances of Hint seem more difficult to set than those of Modal.

Can you give an example of how to do this from config.js? I have managed to do it by overwriting the code in packages/hint.js but I'd rather not do so

alexherbo2 commented 4 years ago

There is currently no way to configure the keyMap from Hint instances, because Krabby does create the object itself. I’m not happy with that and plan to change it.

For the time being, you can override the class method Hint.KEY_MAP:

~/.config/krabby/config.js

Hint.KEY_MAP = () => ({
  Digit1: '1', Digit2: '2', Digit3: '3', Digit4: '4', Digit5: '5', Digit6: '6', Digit7: '7', Digit8: '8', Digit9: '9', Digit0: '0',
  KeyQ: 'q', KeyW: 'w', KeyE: 'e', KeyR: 'r', KeyT: 't', KeyY: 'y', KeyU: 'u', KeyI: 'i', KeyO: 'o', KeyP: 'p',
  KeyA: 'a', KeyS: 's', KeyD: 'd', KeyF: 'f', KeyG: 'g', KeyH: 'h', KeyJ: 'j', KeyK: 'k', KeyL: 'l',
  KeyZ: 'z', KeyX: 'x', KeyC: 'c', KeyV: 'v', KeyB: 'b', KeyN: 'n', KeyM: 'm'
})

Here are some links to figure out how things work:


EDIT

If you are looking for the keys (not the display), see the keys class method and property in hint.js.