7

I have noticed that when coding I type underscores much more often then dashes. Is it possible to swap these keycodes so I can type shiftless underscores? I am using linux (chromebook developer mode).

gloo
  • 277
  • 2
  • 11
  • 1
    very similar question with an accepted answer: http://askubuntu.com/questions/24916/how-do-i-remap-certain-keys – mpower Jul 24 '14 at 15:55

1 Answers1

6

I'm surprised there wasn't more about this specific remapping out there, considering how popular snake_case is.

sudo xmodmap -e "keycode 20 = underscore minus underscore minus"

and to get back to normal:

sudo xmodmap -e "keycode 20 = minus underscore minus underscore"

For anyone wanting to map other keys, see: https://wiki.archlinux.org/index.php/Xmodmap

Basically, run xmodmap -pke to see what the keys are currently mapped to (it gives you the same format as the commands I wrote above), and use xmodmap -e to make your changes.

gronostaj
  • 55,965
  • 20
  • 120
  • 179
Fred
  • 61
  • 1
  • 3