Global Vim-style Navigation On Linux

Created: Dec. 17, 2021 |  Modified: Dec. 17, 2021 |  Categories:  Linux   Productivity  

Tested on Ubuntu 21.10.
Source: https://unix.stackexchange.com/questions/414926/bind-capshjkl-to-arrow-keys-caps-to-esc

Create the configuration file:

Add the following to ~/.my_keyboard:

keycode 66 = Mode_switch
keysym h = h H Left
keysym l = l L Right
keysym k = k K Up
keysym j = j J Down
keysym u = u U Prior
keysym i = i I Home
keysym o = o O End

For more details on the above commands see the xmodmap ArchWiki.

Running xmodmap ~/.my_keyboard enables the changes immediately.

To automatically run this command at startup, add this command to a script and make the script executable:

Go to "Startup Applications Preferences" and add the script as a startup program.