~ashn/setup

ref: b482741c9cb8eaf2083d5ac4fddc127ef097fc26 setup/bin/init-keymap -rwxr-xr-x 685 bytes
b482741cashn Use setlocal instead of set for language-specific indentation 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# Rebind caps lock to escape within the linux terminal.
# Running `showkey` and then hitting escape and then caps lock shows:
#
#   keycode   1 press
#   keycode   1 release
#   keycode  58 press
#   keycode  58 release
#
# Escape is keycode 1 and caps lock is keycode 58.
#
# Running:
#
#   (dumpkeys | grep keymaps; echo "keycode 58 = Escape")
#
# will produce:
#
#   keymaps 0-127
#   keycode 58 = Escape
#
# which when piped into `loadkeys` will remap the keycode 58 (i.e. caps lock) to
# 'Escape' to get the sweet sweet vim-keyboard escape key.

[ "$(id -u)" != "0" ] && echo 'MUST RUN AS ROOT' && exit 1
(dumpkeys | grep keymaps; echo "keycode 58 = Escape") | loadkeys