2

Trying to bind a command to ctrl-up, but /bind ^up doesn't work the way I expect. I'm guessing it's being parsed as ctrl-U+P.

Is there a way to do this?

zigdon
  • 1,689

1 Answers1

5

I opened a terminal, issued cat without parameters and pressed Ctrl+Up and Ctrl+Down. This generated the key codes ^[Oa and ^[Ob for me (do it yourself, the exact codes can rely on terminal, etc.). I then pasted this into irssi as

/bind ^[Oa next_window
/bind ^[Ob previous_window

and now Ctrl+Up and Ctrl+Down goes to the next/previous window respectively.

  • When I try this - I get the same codes for Up and ctrl-up. – zigdon Apr 17 '12 at 07:40
  • Which terminal do you use? Do you run it through tmux/GNU Screen/PuTTY/similar? If you get the same key codes (in the same environment as irssi), then you can not bind them separately, so this needs to be fixed. If you are using e.g. tmux, you should add set-window-option -g xterm-keys on in your ~/.tmux.conf to catch more key codes, and similar options might exist for other configurations. – Daniel Andersson Apr 17 '12 at 07:46
  • screen/putty. Is there a similar option for screen? – zigdon Apr 17 '12 at 07:55
  • Search and ye shall find :-) : http://serverfault.com/questions/130128/using-ctrl-arrow-keys-with-putty-and-screen – Daniel Andersson Apr 17 '12 at 08:40
  • the easiest way to find the code is by running cat and then typing the desired combo – shime Sep 04 '14 at 09:29