alexherbo2 / krabby

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

Keymap change #24

Closed bensleveritt closed 4 years ago

bensleveritt commented 4 years ago

Hallo 👋 ! Pesky COLEMAK user here. Just looking to change the keymap, and I believe I remapped in config.js, but doesn't seem to have an effect.

The help reflects the change accurately, but the actual keybinds don't. Any idea what I'm doing wrong?

20200731160434

My config.js (which I checked is in the package.zip):

// Configuration for Krabby (https://github.com/alexherbo2/krabby/blob/master/src/krabby)

const { modes } = krabby;
const { modal } = modes;

modal.keyMap = {
  Backquote: { key: "`", shiftKey: "~" },
  Digit1: { key: "1", shiftKey: "!" },
  Digit2: { key: "2", shiftKey: "@" },
  Digit3: { key: "3", shiftKey: "#" },
  Digit4: { key: "4", shiftKey: "$" },
  Digit5: { key: "5", shiftKey: "%" },
  Digit6: { key: "6", shiftKey: "^" },
  Digit7: { key: "7", shiftKey: "&" },
  Digit8: { key: "8", shiftKey: "*" },
  Digit9: { key: "9", shiftKey: "(" },
  Digit0: { key: "0", shiftKey: ")" },
  Minus: { key: "-", shiftKey: "_" },
  Equal: { key: "=", shiftKey: "+" },
  KeyQ: { key: "q", shiftKey: "Q" },
  KeyW: { key: "w", shiftKey: "W" },
  KeyE: { key: "f", shiftKey: "F" },
  KeyR: { key: "p", shiftKey: "P" },
  KeyT: { key: "g", shiftKey: "G" },
  KeyY: { key: "j", shiftKey: "J" },
  KeyU: { key: "l", shiftKey: "L" },
  KeyI: { key: "u", shiftKey: "U" },
  KeyO: { key: "y", shiftKey: "Y" },
  KeyP: { key: ";", shiftKey: ":" },
  BracketLeft: { key: "[", shiftKey: "{" },
  BracketRight: { key: "]", shiftKey: "}" },
  Backslash: { key: "\\", shiftKey: "|" },
  KeyA: { key: "a", shiftKey: "A" },
  KeyS: { key: "r", shiftKey: "R" },
  KeyD: { key: "s", shiftKey: "S" },
  KeyF: { key: "t", shiftKey: "T" },
  KeyG: { key: "d", shiftKey: "D" },
  KeyH: { key: "h", shiftKey: "H" },
  KeyJ: { key: "n", shiftKey: "N" },
  KeyK: { key: "e", shiftKey: "E" },
  KeyL: { key: "i", shiftKey: "I" },
  Semicolon: { key: "o", shiftKey: "O" },
  Quote: { key: "'", shiftKey: '"' },
  KeyZ: { key: "z", shiftKey: "Z" },
  KeyX: { key: "x", shiftKey: "X" },
  KeyC: { key: "c", shiftKey: "C" },
  KeyV: { key: "v", shiftKey: "V" },
  KeyB: { key: "b", shiftKey: "B" },
  KeyN: { key: "k", shiftKey: "K" },
  KeyM: { key: "m", shiftKey: "M" },
  Comma: { key: ",", shiftKey: "<" },
  Period: { key: ".", shiftKey: ">" },
  Slash: { key: "/", shiftKey: "?" },
};

As an aside, is it better to remap via keyMap or another way?

alexherbo2 commented 4 years ago

Hey, thanks for trying Krabby!

You change the display, but not the position, like in video games.

If you want to change the mappings, you have to use the map command. (You can press Shift + F1 to navigate to the documentation).

bensleveritt commented 4 years ago

Super helpful, many thanks.

Thanks for closing too, sorry took a while to get back.

underyx commented 4 years ago

For reference, my complete config file for Colemak:

// Configuration for Krabby (https://github.com/alexherbo2/krabby/blob/master/src/krabby)
const { modes } = krabby
const { modal } = modes

modal.keyMap = {
  Backquote: { key: '`', shiftKey: '~' }, Digit1: { key: '1', shiftKey: '!' }, Digit2: { key: '2', shiftKey: '@' }, Digit3: { key: '3', shiftKey: '#' }, Digit4: { key: '4', shiftKey: '$' }, Digit5: { key: '5', shiftKey: '%' }, Digit6: { key: '6', shiftKey: '^' }, Digit7: { key: '7', shiftKey: '&' }, Digit8: { key: '8', shiftKey: '*' }, Digit9: { key: '9', shiftKey: '(' }, Digit0: { key: '0', shiftKey: ')' }, Minus: { key: '-', shiftKey: '_' }, Equal: { key: '=', shiftKey: '+' },
  KeyQ: { key: 'q', shiftKey: 'Q' }, KeyW: { key: 'w', shiftKey: 'W' }, KeyE: { key: 'f', shiftKey: 'F' }, KeyR: { key: 'p', shiftKey: 'P' }, KeyT: { key: 'g', shiftKey: 'G' }, KeyY: { key: 'j', shiftKey: 'J' }, KeyU: { key: 'l', shiftKey: 'L' }, KeyI: { key: 'u', shiftKey: 'U' }, KeyO: { key: 'y', shiftKey: 'Y' }, KeyP: { key: ';', shiftKey: ':' }, BracketLeft: { key: '[', shiftKey: '{' }, BracketRight: { key: ']', shiftKey: '}' }, Backslash: { key: '\\', shiftKey: '|' },
  KeyA: { key: 'a', shiftKey: 'A' }, KeyS: { key: 'r', shiftKey: 'R' }, KeyD: { key: 's', shiftKey: 'S' }, KeyF: { key: 't', shiftKey: 'T' }, KeyG: { key: 'd', shiftKey: 'D' }, KeyH: { key: 'h', shiftKey: 'H' }, KeyJ: { key: 'n', shiftKey: 'N' }, KeyK: { key: 'e', shiftKey: 'E' }, KeyL: { key: 'i', shiftKey: 'I' }, Semicolon: { key: 'o', shiftKey: 'O' }, Quote: { key: "'", shiftKey: '"' },
  KeyZ: { key: 'z', shiftKey: 'Z' }, KeyX: { key: 'x', shiftKey: 'X' }, KeyC: { key: 'c', shiftKey: 'C' }, KeyV: { key: 'v', shiftKey: 'V' }, KeyB: { key: 'b', shiftKey: 'B' }, KeyN: { key: 'k', shiftKey: 'K' }, KeyM: { key: 'm', shiftKey: 'M' }, Comma: { key: ',', shiftKey: '<' }, Period: { key: '.', shiftKey: '>' }, Slash: { key: '/', shiftKey: '?' }
}

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: 'f', KeyR: 'p', KeyT: 'g', KeyY: 'j', KeyU: 'l', KeyI: 'u', KeyO: 'y', KeyP: ';',
  KeyA: 'a', KeyS: 'r', KeyD: 's', KeyF: 't', KeyG: 'd', KeyH: 'h', KeyJ: 'n', KeyK: 'e', KeyL: 'i',
  KeyZ: 'z', KeyX: 'x', KeyC: 'c', KeyV: 'v', KeyB: 'b', KeyN: 'k', KeyM: 'm'
})

Hint.keys = () => (
  ['KeyA', 'KeyJ', 'KeyS', 'KeyK', 'KeyD', 'KeyL', 'KeyG', 'KeyH', 'KeyE', 'KeyW', 'KeyO', 'KeyR', 'KeyU', 'KeyV', 'KeyN', 'KeyC', 'KeyM']
)