-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Linux Console Keybindings
Zachary Yedidia edited this page Sep 13, 2017
·
1 revision
If you are using the Linux console (TERM=linux
) then shift-arrows, alt-arrows, and ctrl-shift-arrows are not reported to micro. There is a simple workaround though.
Make a file called supplemental.kmap
containing the following:
# The following is a map with supplemental key mappings for the linux console.
# Using these mappings will allow distinction between key presses for several
# keys with and without control and shift modifiers.
# These mappings can be loaded with the loadkeys(1) program. Simply run
# loadkeys supplemental.kmap
# as root to add these mappings to your console. How to make these changes
# permanent depends on your distribution. There are also two ways to make these
# changes permanent: create a keymap which contains this file, or add a job
# which is run on startup and executes the above loadkeys command.
# Debian (or Debian based such as Ubuntu):
# Add the contents of this file to /etc/console-setup/remap.inc and run
# "dpkg-reconfigure -u keyboard-configuration" as root. Adding the mappings
# to the remap.inc file will ensure that the mappings are activated, even if
# another keyboard layout is chosen at a later time.
# Right
control keycode 106 = F100
shift keycode 106 = F101
control shift keycode 106 = F102
# Left
control keycode 105 = F103
shift keycode 105 = F104
control shift keycode 105 = F105
# Up
shift keycode 103 = F106
# Down
shift keycode 108 = F107
string F100 = "\033[1;5C"
string F101 = "\033[1;2C"
string F102 = "\033[1;6C"
string F103 = "\033[1;5D"
string F104 = "\033[1;2D"
string F105 = "\033[1;6D"
string F106 = "\033[1;2A"
string F107 = "\033[1;2B"
(modified from the supplemental.kmap
file used in the Tilde editor)
Then call sudo loadkeys supplemental.kmap
to load the file. Special arrow key bindings should now work in micro.
Note you will have to call sudo loadkeys supplemental.kmap
every time the computer boots, so you may want to make a startup job which runs the command.
See #802 for the original discussion.