aboutsummaryrefslogtreecommitdiff
path: root/.config/xkb/symbols/vim_keys
blob: 34f2ca5d82afb5d24d68fbbdeb6ddc07f1037b5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// ~/.config/xkb/symbols/vim_keys

xkb_symbols "basic" {
    include "us(basic)"
    include "custom(altgr)"

    clear  lock;
    clear  mod5;
    clear  control;

    // Define a custom modifier (Mode_switch)
    modifier_map Mod5 { <MDSW> };

    // Remap Caps Lock to AltGr (ISO_Level3_Shift)
    key <CAPS> {
        type[Group1] = "ONE_LEVEL",
        symbols[Group1] = [ ISO_Level3_Shift ],
        actions[Group1] = [ SetMods(modifiers=Mod5) ]
    };

    // Remap h, j, k, l to arrow keys when Mode_switch is active
    key <AC06> { [ Left ] };
    key <AC07> { [ Down ] };
    key <AC08> { [ Up ] };
    key <AC09> { [ Right ] };

    // Assign keys to the CtrlMod modifier
    key <RCTL> { [ Control_R, Control_R ] };
    key <LCTL> { [ Control_L, Control_L ] };

    // Define Ctrl+Mode_switch+J as PageDown
    key <I194> { [ Control_R, ISO_Level3_Shift, Prior ] };
    key <I194> { [ Control_L, ISO_Level3_Shift, Prior ] };

    // Define Ctrl+Mode_switch+K as PageUp
    key <I196> { [ Control_R, ISO_Level3_Shift, Next ] };
    key <I196> { [ Control_L, ISO_Level3_Shift, Next ] };

    // Define Ctrl+Mode_switch+H as Home
    key <AC06> { [ Control_R, ISO_Level3_Shift, Home ] };
    key <AC06> { [ Control_L, ISO_Level3_Shift, Home ] };

    // Define Ctrl+Mode_switch+L as End
    key <AC09> { [ Control_R, ISO_Level3_Shift, End ] };
    key <AC09> { [ Control_L, ISO_Level3_Shift, End ] };

    // Make 'q' act as Escape when in Mode_switch
    key <AD03> { [ q, Q, Escape ] };

    // Shift+Caps to use normal Caps Lock
    modifier_map Mod5 { Shift+CapsLock, <MDSW> };
};