Tip: Easy on your fingers

I am getting some pain on my fingers, and since we type ( and ) quite often in prolog, I found a way to make it a little easier on my fingers. I now type ( and ) without the shift key.

Perhaps it will be useful for some of you. This works only on Linux, don’t know about other OSes.

  • Install xmodmap for your distro
  • Write ~/.xmodmap with this content:
!  Change parens, brackets, and braces
! Original settings
! -----------------
! keycode  18 = 9 parenleft 9 parenleft leftsinglequotemark dead_breve leftsinglequotemark
! keycode  19 = 0 parenright 0 parenright rightsinglequotemark dead_abovering rightsinglequotemark
! keycode  34 = bracketleft braceleft bracketleft braceleft guillemotleft leftdoublequotemark guillemotleft
! keycode  35 = bracketright braceright bracketright braceright guillemotright rightdoublequotemark guillemotright

! Change ( to {  and  ) to }
keycode  18 = 9 braceleft 9 braceleft leftsinglequotemark dead_breve leftsinglequotemark
keycode  19 = 0 braceright 0 braceright rightsinglequotemark dead_abovering rightsinglequotemark

! Change { to [  and  } to ]
!        [ to (  and  ] to )
keycode  34 = parenleft bracketleft parenleft bracketleft guillemotleft leftdoublequotemark guillemotleft
keycode  35 = parenright bracketright parenright bracketright guillemotright rightdoublequotemark guillemotright
  • run xmodmap ~/.xmodmap
  • Now you can type the parenthesis by pressing [ and ] without the shift key
  • It takes a while to get used to the new mapping, but it is worth it for me.

NOTE: If you want you can store the old keymap by running xmodmap -pke > ~/.original_keymap before making tha changes above. You can restore it by running xmodmap ~/.original_keymap. You can use this in a shell script if you want to change the parenthesis only when you run swipl.

Good idea! Most of my work is in Clojure, so I’ve also found remapping the paren keys to something easier vital for hand health. Something similar that I did (before switching to a keyboard that let me do even more remappings) was use the xcape program to make left & right shift act as normal shift keys when held, but when tapped would produce left & right parens.

Config for that was simply putting xcape -e 'Shift_L=parenleft;Shift_R=parenright' in my ~/.xsessionrc.

1 Like

I never thought about remapping the shift keys, that’s a good idea! Thanks for the tip!

1 Like

Nice idea, and added to my Xmodmap. Seems much more fluid for typing. Thanks for sharing.