Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What key combo do I use to bind ctrl+insert in my zshrc? I tried entering quoted-insert mode (ctrl+V) but pressing ctrl+insert does not output anything.

share|improve this question

migrated from May 19 '13 at 23:58

This question came from our site for professional and enthusiast programmers.

up vote 0 down vote accepted

I succeed in URxVt with

bindkey '^[[2^' zle-widget

and in xterm with

bindkey '^[[2;5~' zle-widget

As you can see, the string which needs to be bound is rather dependent on your terminal emulator (and yor X keybindings), not your shell.

The usual trick to get the key strings is to start cat and press the desired key combination:

$ cat

Additionally, the following escape sequences are recognised (from man zshzle) by bindkey

   \a     bell character
   \b     backspace
   \e, \E escape
   \f     form feed
   \n     linefeed (newline)
   \r     carriage return
   \t     horizontal tab
   \v     vertical tab
   \NNN   character code in octal
   \xNN   character code in hexadecimal
   \M[-]X character with meta bit set
   \C[-]X control character
   ^X     control character
share|improve this answer
I'm using gnome-terminal ^[[2;5~ did not work for me. How do I discover what string it uses? – RedHatter May 20 '13 at 19:52
@RedHatter: I added the usual way to my answer. However this does not work with gnome-terminal, it seems that Ctrl+Ins isn't passed to the running process at all. I tried to remove all key bindings in the terminal itself, but unfortunately this doesn't change anything. – mpy May 21 '13 at 8:42
That's too bad.... what about ctrl+tab? I remember reading somewhere that tab was ^I, but nether that nor ^[[^I work. – RedHatter May 22 '13 at 19:19
@RedHatter: You are right, ^I is tab (and that's one rare case, where the cat trick doesn't work), but you can also use \t. However I wasn't able to bind Ctrl+Tab with xterm or urxvt, too. – mpy May 22 '13 at 19:59
@RedHatter: Although I appreciate that you accepted my answer, I recommend to undo that (your problem isn't solved) and change the question title to e.g. 'Bind Ctrl+Tab in Gnome Terminal'. I already added the corresponding tag yesterday as I'm pretty sure that's not a zsh issue (or are you able to bind this combination in bash?). That way you have better chances that a gnome expert will have a look -- I came here by the zsh tag and even had to ,,conquer'' a colleague's machine as I don't have gnome-terminal installed myself ;) – mpy May 22 '13 at 20:06

You must log in to answer this question.

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