keyboard tweaking without X
On 17 May 2007 Tyler Smith <tyler.smith@mail.mcgill.ca> asked:
> Are these just part of working in a console,
> or can someone point me to a resource for fixing them up?
Keyboard-and-Console-HOWTO
/etc/init.d/keymap.sh loads /etc/console/boottime.kmap.gz
bash bind has an emacs-editing-mode which you might find useful.
man showkey -s -m -k
^v - Control v
man setmetamode
man kbd_mode (careful with this one)
In RedHat5 I had gitkeys available:
GNU Interactive Tools 4.3.16 - Display key sequence utility
The following scripts I use to :
1) document how I have my keyboard setup.
2) set my keyboard up the way I want it, mostly based on
comfortable mappings of the readline editing functions.
setkeys runs every time I boot up.
HTH,
Mike
------------------------ cut here --------------------------
#!/bin/bash
# /mc/bin/getkeys Jun 3 2004 Mc
# to collect data about key assignments
# 040707 made distribution independant & moved to /mc/bin/
TargetPath=/mc/docs$DISTRIBUTION/keys
Prompt=root@$DISTRIBUTION
if [ ! -e $TargetPath ] ; then
echo $TargetPath doesnt exist.;
echo $Prompt
exit;
fi
Target=$TargetPath/dumpkeys.txt
echo "$Prompt:~> dumpkeys > $Target" > $Target
date >> $Target
dumpkeys >> $Target
Target=$TargetPath/dumpkeys-f.txt
echo "$Prompt:~> dumpkeys -f > $Target" > $Target
date >> $Target
dumpkeys -f >> $Target
Target=$TargetPath/dumpkeys--long-info.txt
echo "$Prompt:~> dumpkeys --long-info > $Target" > $Target
date >> $Target
dumpkeys --long-info >> $Target
Target=$TargetPath/stty-a.txt
echo "$Prompt:~> stty -a > $Target" > $Target
date >> $Target
stty -a >> $Target
Target=$TargetPath/bind-p.txt
echo "$Prompt:~> bind -p > $Target" > $Target
date >> $Target
echo bind -p is not working from script! must do by hand
echo 'Cut/Paste'
echo "bind -p >> $Target"
bind -p >> $Target
Target=$TargetPath/getkeycodes.txt
echo "$Prompt:~> getkeycodes > $Target" > $Target
date >> $Target
getkeycodes >> $Target
------------------------ cut here --------------------------
# /mc/bin/setkeys started on DosLinux 28 Oct. '98 Mc
# a script to reset my keyboard prefs after 'loadkeys us'
# Thu Jan 11 2001 added lpe /slak70
# 040707 here doc
LOADKEYS=$(which loadkeys)
if [ -x $LOADKEYS ]; then
echo "$LOADKEYS" found.
cat << EOT | $LOADKEYS
# This is so you can open another console using the left-Alt & Up-arrow key.
alt keycode 103 = Spawn_Console
altgr keycode 103 = Spawn_Console
altgr keycode 105 = Decr_Console
altgr keycode 106 = Incr_Console
# forward/backword_word --> ^Right/^Left cursor keys
control keycode 105 = Meta_b
control keycode 106 = Meta_f
# ^Home --> bash:backward-kill-line
control keycode 102 = Control_u
# ^End --> bash:kill-line
control keycode 107 = Control_k
# ^BS --> bash:backward-kill-word
control keycode 14 = F102
string F102 = "\033\010"
# ^Pg_Up --> start of buf in lpe
control keycode 104 = F105
string F105 = "\033[[5~"
# ^Pg_Down -- end of buf in lpe
control keycode 109 = F106
string F106 = "\033[[6~"
# Shift Insert --> bash:yank (paste)
shift keycode 110 = Control_y
# Altgr Insert --> bash:yank_pop (paste+)
altgr keycode 110 = Meta_y
# ^Del --> lpe:kill, bash:kill-whole-line (cut)
control keycode 111 = F108
string F108 = "\033[[3~"
# Altgr Del --> bash:kill-word
altgr keycode 111 = Meta_d
# Altgr / --> lpe:do_macro
altgr keycode 53 = Meta_slash
EOT
# EOT MUST be first & only thing on the line
else
echo $LOADKEYS not found.
fi
unset LOADKEYS
------------------------ cut here --------------------------
Reply to: