// ~/.config/xkb/symbols/vim_keys // Clear existing modifiers default partial modifier_keys xkb_symbols "basic" { clear lock; clear mod5; // Define a custom modifier (Mode_switch) modifier_map Mod5 { }; // Remap Caps Lock to AltGr (ISO_Level3_Shift) key { 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 { [ Left ] }; key { [ Down ] }; key { [ Up ] }; key { [ Right ] }; // Make 'q' act as Escape when in Mode_switch key { [ q, Q, Escape ] }; // Shift+Caps to use normal Caps Lock modifier_map Mod5 { Shift+CapsLock, }; };