// ~/.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 { }; // 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 ] }; // Assign keys to the CtrlMod modifier key { [ Control_R, Control_R ] }; key { [ Control_L, Control_L ] }; // Define Ctrl+Mode_switch+J as PageDown key { [ Control_R, ISO_Level3_Shift, Prior ] }; key { [ Control_L, ISO_Level3_Shift, Prior ] }; // Define Ctrl+Mode_switch+K as PageUp key { [ Control_R, ISO_Level3_Shift, Next ] }; key { [ Control_L, ISO_Level3_Shift, Next ] }; // Define Ctrl+Mode_switch+H as Home key { [ Control_R, ISO_Level3_Shift, Home ] }; key { [ Control_L, ISO_Level3_Shift, Home ] }; // Define Ctrl+Mode_switch+L as End key { [ Control_R, ISO_Level3_Shift, End ] }; key { [ Control_L, ISO_Level3_Shift, End ] }; // 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, }; };