If you have a compose file you can use it as a poor-man’s text insertion utility.
You can use a few of the modifiers in X. Apparently you can use
Shift as a modifier:
! Ctrl Shift <k> : "<kbd></kbd>"
But this does not work, at least on my machine.
Nor does this work (omitted
! Ctrl <K> : "<kbd></kbd>"
However, you can use
! Ctrl Alt <k> : "<kbd></kbd>"
! Ctrl <k> : "<kbd></kbd>"
Placing the cursor correctly
The above mappings will place the cursor after the string (
| indicates the cursor):
I reckon there can be no general-purpose solution for putting the cursor inside of the tag; for that you would need to use a fit-for-purpose tool. But you can the cursor go inside the tag in certain applications.
gnome-terminal with Bash which uses readline keybindings (Emacs-like).
Ctrl-b is the keybinding for going backwards one character. In my terminal I can type
Ctrl+v b and get the control character
^B (U+0002 (Start of Text)). So type six of these characters at the end of the string:
! Ctrl Alt <k> : "<kbd></kbd>^B^B^B^B^B^B"
The cursor will be placed inside the tag if you are inside an application that interprets
^B correctly (e.g. terminals and Emacs):
Using the compose key
You can of course use the compose key (
<Multi_key>) to achieve the same thing. For example, use
t (“tag”) and
<Multi_key> <t> <k> : "<kbd></kbd>^B^B^B^B^B^B"