keybindings with non english keyboard layout

mooz edited this page Nov 7, 2010 · 1 revision

If you use non-english keyboard layout and want to use keysnail with this layout, you can add following code to duplicate all keysnail keybindings.

Paste the snippets below to the appropriate position of your init file (.keysnail.js).

Inside the PRESEVERE area:

key.isDisplayableKey = function (ev) {
    return ev.charCode !== 0;

Bottom of the init file (outside of the PRESERVE area):

let table = {
    "q": "й",
    "w": "ц",
    "e": "у",
    "r": "к",
    "t": "е",
    "y": "н",
    "u": "г",
    "i": "ш",
    "o": "щ",
    "p": "з",
    "[": "х",
    "]": "ъ",
    "a": "ф",
    "s": "ы",
    "d": "в",
    "f": "а",
    "g": "п",
    "h": "р",
    "j": "о",
    "k": "л",
    "l": "д",
    ";": "ж",
    "'": "э",
    "z": "я",
    "x": "ч",
    "c": "с",
    "v": "м",
    "b": "и",
    "n": "т",
    "m": "ь",
    ",": "б",
    ".": "ю",
    "/": "."

function replacer(keymap) {
    for (let [k, f] in Iterator(keymap))
        if (typeof keymap[k] === "object")
        if (/^(C-|M-)/.test(k))
        if (((k <= 'z' && k >= 'a') || (k <= 'Z' && k >= 'A')) && table[k])
            keymap[table[k]] = keymap[k];

for (let [mode, keymap] in Iterator(key.keyMapHolder))
    if (!keymap)

Example above is for russian layout. You should edit table variable to your taste, of course.