In Vim, I had set the Ctrl+Arrow keys to skip words. This works just fine when running Vim inside the gnome-terminal.

However, when using byobu (tmux), it shows weird behavior : it deletes everything after the cursor.

For reference, these are my vim settings:

:inoremap <C-Left> <C-\><C-O>b
:inoremap <C-Right> <C-\><C-O>w

2 Answers 2


The problem is twofold. First, tmux by default converts the control-arrow keys from one type of escape sequence to another. So special keys such as controlleft are sent to vim without the modifier, e.g., left. If you use cat -v to see the different escape sequences, you might see something like this


versus this (outside tmux):


The line

set-window-option -g xterm-keys on

fixes that aspect. The other part is that tmux by default uses the terminal description for screen. That terminal description does not describe the control-arrow keys. These entries from the terminal database would be the most appropriate for VTE (gnome-terminal):

There are others, such as

which would be automatically selected when running in screen if the corresponding TERM outside were vte, vte-256color, etc. tmux does not do this automatic-selection; you have to modify its configuration file.

By the way, there is no "screen.xterm" entry because it would interfere with some usages of screen. There is no conflict with TERM=xterm-new.

If you have a default (minimal) terminal database such as ncurses-base in Debian, you might not have those. More common would be xterm-256color, which is close enough to use with vim and tmux.

For example, if I add this to my .tmux.conf file, it behaves as you expect in vim:

set -g default-terminal "xterm-256color"

Further reading:

  • Hmmm... This does work :) But only partially. Only Control+Left is working; Control+Right isn't. I'll test and update later.
    – shivams
    Commented Jun 18, 2016 at 1:13
  • 1
    You may have some other binding interfering with control+right (given details, I may offer advice). Commented Jun 18, 2016 at 10:46
  • Thank you for the offer :) I investigated a bit and found that indeed some other keybindings are causing interference. E.g. on my Mac this works fine, while in Linux (using Guake) it isn't. However, I'm out of station right and can't access my Linux. I will update when I resolve the issue.
    – shivams
    Commented Jul 8, 2016 at 14:22
  • @Thomam Dickey: Meanwhile, I am accepting your answer as it does indeed solve the problem.
    – shivams
    Commented Jul 8, 2016 at 14:22
  • @ThomasDickey I'd just like to say, "Go raibh míle maith agat" which in Irish is literally translated as "May you have a thousand good things." Thank you so much for this answer. You're a star.
    – Rob
    Commented Feb 17, 2020 at 10:19

From here you can unbind the key combination in byobu:

Create a file ~/.byobu/.tmux.conf with (or add if the file exists):

set-window-option -g xterm-keys on

Then add the following to ~/.byobu/keybindings.tmux:

unbind-key -n C-Left
unbind-key -n C-Right
  • This doesn't work. However it has given me solid lead. I'll try to follow the lead and come up with some solution. Thanks :)
    – shivams
    Commented May 19, 2016 at 4:17

You must log in to answer this question.

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