• To get TAB and ctrl-i to do different things. I added the following configuration to my xterm and bash configuration files, and everything worked fine
XTerm.vt100.translations: #override \n\
    Ctrl <Key>I: string("\033[a5i")
bind -m vi-insert -x '"\e[a5i": echo aa'
  • But when I ran bash in tmux, the above configuration didn't work properly, and when I hit ctrl-i, instead of executing the echo command, screen printed out 5i

  • I tried to perform this binding in tmux, but the results were not satisfactory

    Where ^[[1;2A5i is the key sequence of ctrl-i I got using the read command

bind-key -n ^[[1;2A5i 'send-keys \033[a5i'

tmux doesn't understand this key sequence. You can make it do so by adding it as a user key and then making that key send the sequence to panes inside tmux:

set -s user-keys[0] "\e[a5i"
bind -n User0 send Escape "[a5i"
  • Oh, thanks, but when I press ctrl-i in bash, I can trigger the binding, but it still prints 5i more – yyy33 May 23 '20 at 7:07

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.