Use HJKL as Navigation Globally

Previously i’m using xmodmap to re-map shortcut CapsLock + HJKL to navigate using vim mode globally. But, it’s don’t work anymore on Wayland.
And then, I found some answer on askubuntu to modify xkbd keymap.

Edit following file :

/usr/share/X11/xkb/symbols/us

Make sure create a backup first. And add this code on first block

# replace Caps with AltGr
key <CAPS> { [ ISO_Level3_Shift ] };
# Add vim cursor keys to be accessed with AltGr
key <AB02> { [ x, X, Delete, Delete ] };
key <AC02> { [ s, S, KP_Enter, KP_Enter ] };
key <AC03> { [ d, D, Next, Next ] };
key <AC04> { [ f, F, BackSpace, BackSpace ] };
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 <AD07> { [ u, U, Prior, Prior ] };
key <AE03> { [ 3, numbersign, Home, Home ] };
key <AE04> { [ 4, dollar, End, End ] };

Re-Login to take effect.