3

I'm trying to bind Control-Tab to a shell function in Bash.

I've tried the following things in my .bashrc:

bind -m vi-insert -x '"\C-\t": some_user_function'
bind -m vi-insert -x '"\C-TAB": some_user_function'
bind -m vi-insert -x '"\C-\TAB": some_user_function'

But neither work. I couldn't find anything in help bind and man bash either.

However bind -m vi-insert -x '"\C-x": some_user_function' work so it is clearly a problem with telling bind to recognize the tab key somehow.

0

1 Answer 1

4

short: terminals don't do that.

long: bash runs in a terminal. While some provide an escape sequence for shifttab, you're unlikely to find one doing this for controltab unless you specially configure it yourself (using features of a specific terminal emulator).

3
  • Oh, I knew about Shift-Tab and thought that Control-Tab will work because the Readline Initialization and Readline Key Bindings sections of man bash suggested that they understand TAB and \t - so I thought that I can combine that with the control key. Commented Mar 24, 2017 at 15:05
  • no - it's already a control-key, and only terminals that allow configuring X events (or Windows events...) will be able to do this. Commented Mar 24, 2017 at 15:07
  • Thanks, I didn't know about it. It makes perfect sense now. Commented Mar 24, 2017 at 15:08

You must log in to answer this question.

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