The Linux kernel generates a code each time a key is pressed on a keyboard. That code is compared to a table of keycodes
defining a figure that is then displayed.
This process is complicated by Xorg
, which starts its own table of keycodes
. Each keycode
can belong to a keysym
. A keysym
is like a function, started by typing a key. Xmodmap
allows you to edit these keycode-keysym
relations.
To get the current keymap table using Xmodmap
use:
xmodmap -pke
This will print out the full table in the following format:
keycode <keycode#> = <boundkey> <boundkey>
Before moving anything around be sure to backup the original keycode
layout using xmodmap -pke >> $HOME/Xmodmap.orig
This will place the file Xmodmap.orig
in your users home directory.
Tip: There are also some predefined keycodes (e.g. XF86AudioMute
, XF86Mail
). Those keycodes can be found in: /usr/include/X11/XF86keysym.h
You can also also edit the keys: Shift
, Ctrl
, Alt
and Super
(there always exists a left and a right one (Alt_R=AltGr
)).
Here's a quick example of how your configuration would look if you wanted to swap CTRL
and Super
(Windows Key):
keycode 255 =
!add Shift = Shift_L Shift_R
!add Lock = Caps_Lock
add Control = Super_L Super_R
!add Mod1 = Alt_L Alt_R
!add Mod2 = Mode_switch
!add Mod3 =
add Mod4 = Control_L Control_R
!add Mod5 =
(the !
is used to comment / ignore the line. in this example only Super
and Control
keys get adjusted)
This configuration would be saved in $HOME/.Xmodmap
and loaded with
xmodmap ~/.Xmodmap
You could also start this with xwindows by adding it to your ~/.xinitrc
And if things get hairy you can always revert back to Xmodmap.org
.
Any bindings for applications that rely on these keys would also be moved. So make sure that everything remains bound so you don't lose any functionality. It's a tug-of-war match.
One workaround is using (remotely accessed) scratch files to transfer the text:
In case you can SSH back to your own system, you can just :split scp://hostname/path/to/file
, put the yanked text there, and :write
.
If you can just use SSH from your system to the server box, open Vim locally and access the scratch file from the server: vim scp://server/path/to/file
(or just use scp
directly).
This is all enabled by the netrw plugin that ships with Vim.
Best Answer
You can change your settings in Gnome Terminal keyboard settings to make
Menu > Edit > Keyboard Shortcuts...
Then you can still press Shift to do whatever that key combination would usually do in a terminal, e.g.
Alternatively, you could get into the habit of using
in all applications, to avoid ever accidentally pressing Ctrl+C in your terminal and having it abort the program instead of copying some text. Those shortcuts date back to the IBM Common User Access standards. Some people might remember them from DOS EDIT.