1

I'd like to do something like this

bind-key -T root ' <some-command>
bind-key -T root " <some-command>
bind-key -T root : <some-command>
bind-key -T root ; <some-command>

# or with alt
bind-key -T root M-' <some-command>
bind-key -T root M-" <some-command>
bind-key -T root M-: <some-command>
bind-key -T root M-; <some-command>

# or with control
bind-key -T root C-' <some-command>
bind-key -T root C-" <some-command>
bind-key -T root C-: <some-command>
bind-key -T root C-; <some-command>

# or with alt & control
bind-key -T root M-C-' <some-command>
bind-key -T root M-C-" <some-command>
bind-key -T root M-C-: <some-command>
bind-key -T root M-C-; <some-command>

What of these are possible?

Is there a tool which gets pressed keys and gives ascii representation ready to use in bind-key. Something like vim Control-v in command mode (:).

1 Answer 1

2

You should be able to do these bindings:

bind-key -T root '"' send-keys ' dblquot'
bind-key -T root "'" send-keys ' quot'
bind-key -T root :   send-keys ' colon'
bind-key -T root \;  send-keys ' semicolon'

and their Meta prefix versions:

bind-key -T root 'M-"' send-keys ' Mdblquot'
bind-key -T root "M-'" send-keys ' Mquot'
bind-key -T root M-:   send-keys ' Mcolon'
bind-key -T root M-\;  send-keys ' Msemicolon'

and test them, but a terminal emulator is not able to apply Control to characters outside the ascii range @ to _ (i.e. a to z plus @[\]^_), so you cannot type Control-' and so on, nor their Meta-Control versions.

2
  • a terminal emulator is not able to apply Control to characters outside the ascii range @ to _ ... so that's why! Any workaround or do we simply have to give up on M-\;?
    – PiCTo
    Jun 4, 2019 at 10:42
  • A terminal emulator might provide, for example, a lower-level access to the X11 raw keycodes and current status of the Control and Meta shift keys, and allow you to convert that combination into a single unicode character, or a sequence of characters. If you are using a particular emulator you could try posting a question on unix.stackexchange.com giving details on it and the graphics server (X11 or wayland etc) you want to use.
    – meuh
    Jun 4, 2019 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .