create custom mapping file #

$ cat /usr/share/X11/xkb/symbols/xkb-capslock-vim 
partial keypad_keys
xkb_symbols "capslock-vim" {
  # replace Caps with AltGr
  key <CAPS> { [ ISO_Level3_Shift            ] };
  # Add vim cursor keys to be accessed with AltGr
  key <AC06> { [ h, H , Left, Left           ] };
  key <AC07> { [ j, J, Down, Down            ] };
  key <AC08> { [ k, K, Up, Up                ] };
  key <AC09> { [ l, L, Right, Right          ] };
  key <AD08> { [ i, I, Home, Home            ] };
  key <AC10> { [ semicolon, colon, End, End              ] };
  key <AD07> { [ u, U, BackSpace, BackSpace          ] };
  key <AB09> { [ period, greater, Delete, Delete  ] };
  key <AB06> { [ n, N, Next, Next            ] };
  key <AB07> { [ m, M, Prior, Prior          ] };
  #key <AB08> { [ comma, less, BackSpace, BackSpace  ] };
  #key <AB09> { [ period, greater, Delete, Delete  ] };
  #key <AC11> { [ apostrophe, quotedbl, End, End              ] };
};




add include line #

$ head /usr/share/X11/xkb/symbols/us
default  partial alphanumeric_keys modifier_keys
xkb_symbols "basic" {

    include "xkb-capslock-vim(capslock-vim)"

    name[Group1]= "English (US)";

    key <TLDE> {	[     grave,	asciitilde	]	};
    key <AE01> {	[	  1,	exclam 		]	};
    key <AE02> {	[	  2,	at		]	};
    ....

execute #

~/bin$ cat setxkbmap.sh 
#setxkbmap -option caps:escape
setxkbmap -layout us # this will also applied when boot
xcape -e 'ISO_Level3_Shift=Escape'

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2020-07-27 23:56:07
Processing time 0.0060 sec