3

I'm tweaking with GNU Readline's key bindings in Bash. Specifically, I wish to achieve the following mapping effect:

Control' ==> 'I'

ControlShift' ==> "I"

Control` ==> `I`

Control[ ==> [I]

ControlShift[ ==> {I}

where I indicates the cursor position after expansion.

I have tried the following configuration in my ~/.inputrc. However, only the <C-`> mapping works as expected:

$include /etc/inputrc
$if mode=emacs
"\C-\'": "\'\'\C-b"
"\C-`": "``\C-b"
"\C-\"": "\"\"\C-b"
"\C-{": "{}\C-b"
"\C-[": "[]\C-b"
$endif

I'm wondering what is wrong with my configuration and how to make these mappings correctly (if possible)?

3

In a terminal, you generally cannot get all combinations of control- and shift-modifiers to be different values:

  • the basis for control and shift is from US-ASCII (and similar) schemes which defines control and shift for the alphabetic characters plus a few punctuation characters.
  • the combination control+shift usually has no effect, except for special keys.
  • some terminals define escape sequences for control/shift with special keys (such as cursor- and function-keys). The tab key is not one of those keys.

Here is a screenshot to illustrate the control characters using ASCII:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.