Skip to content

Instantly share code, notes, and snippets.

@XueshiQiao
Last active August 9, 2022 06:33
Show Gist options
  • Save XueshiQiao/e839d62ceb29128542d9be144be187ec to your computer and use it in GitHub Desktop.
Save XueshiQiao/e839d62ceb29128542d9be144be187ec to your computer and use it in GitHub Desktop.
Global Vim-like Arrow Mapping configuration using xmodmap on Ubuntu
! ref: https://wiki.archlinux.org/title/Xmodmap
! exec: xmodmap ~/.Xmodmap
! Set Keyboard::Dispatch to 'keyCode' in VSCode, otherwise capslock remapping does't work
! ref: https://github.com/microsoft/vscode/issues/23991
! auto startup with system:
! add following command to 'Startup Applications Preferences' app on Ubuntu
! /bin/bash -c 'xmodmap /home/xueshi/.Xmodmap'
clear lock
! Map Caplock key to Mode_switch key, we use it as 'Hyper' key later
! Shift+Capslock = CapsLock
keycode 66 = Mode_switch Caps_Lock NoSymbol NoSymbol
! four symbols sequceces meanings: Key | Shift+Key | Mode_switch+Key | Mode_switch+Shift+Key
! Mode_switch + h = Left
keycode 43 = h H Left H
keycode 44 = j J Down J
keycode 45 = k K Up K
keycode 46 = l L Right L
! Backspace
keycode 31 = i I BackSpace I
! page up / down
keycode 30 = u U Prior U
keycode 40 = d D Next D
keycode 38 = a A Home A
keycode 26 = e E End E
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment