20

On my Ubuntu 11.10 machines running byobu 4.37 I can use the key combination Ctrl+ / Ctrl+ to jump a word at a time in the terminal. However, on my Ubuntu 12.04 machines with byobu 5.17 this no longer works.

I've read that byobu has remapped those key combinations to resize splits, and now Alt+ and Alt+ have the desired effect. However, I'm unable to find where Alt+ and Alt+ are mapped, in order to remap Ctrl+ and Ctrl+. If I unmap the key bindings for Ctrl+ and Ctrl+, then the cursor moves only 1 character at a time, not 1 word at a time.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
chmac
  • 449

3 Answers3

11

One solution was to switch the backend to screen. However, I had recurring issues with ctrl-right when I did that. To do that change ~/.byobu/backend to BYOBU_BACKEND=screen.

I subsequently found a much better solution using tmux from this bug. Create ~/.byobu/.tmux.conf with this value:

set-window-option -g xterm-keys on

Then ~/.byobu/keybindings.tmux with:

unbind-key -n C-Left
unbind-key -n C-Right

Now ctrl-left and ctrl-right jump one word at a time in tmux.

chmac
  • 449
1

In my ~/.zshrc

bindkey '^[[1;5D' backward-word
bindkey '^[[1;5C' forward-word

... And now ctrl+left / right jump words in byobu / tmux.

yPhil
  • 1,557
  • 14
  • 25
  • That's a useful trick. I guess it only works for zsh shells. Personally, I'm using zsh locally, but bash everywhere else. – chmac Feb 20 '14 at 10:22
0

The reason for the change is because now Byobu is using tmux as the backend, instead of screen.

CTRL-Left & CTRL-Right are used in tmux for navigating panes, so we have to tell tmux not to do this! Just edit your ~/.byobu/keybindings.tmux and add the following lines to the end:

unbind-key -n C-Left
unbind-key -n C-Right

Just log out/back in and you should see the change.

*Note, this will only work for xterm, not for the actual ttys. You will notice that even without using byobu, ctrl-left and ctrl-right do not behave as expected from a tty. Ubuntu seems to ignore /etc/inputrc when using a tty for some reason.

Oli
  • 293,335
reverendj1
  • 16,045