Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

On my Ubuntu 11.10 machines running byobu 4.37 I can use the key combination ctrl-left / ctrl-right 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-left and alt-right have the desired effect. However, I'm unable to find where alt-left and alt-right are mapped, in order to remap ctrl-left and ctrl-right. If I unmap the keybindings for ctrl-left and ctrl-right, then the cursor moves only 1 character at a time, not 1 word at a time.

share|improve this question

migrated from serverfault.com May 31 '12 at 17:57

This question came from our site for professional system and network administrators.

    
+1! I've been puzzled by this a lot. –  jrg May 31 '12 at 18:50

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
1  
I tried that, but then ctrl-left/right only moves one character at a time, not a whole word. –  chmac Jun 1 '12 at 19:41
    
I can confirm @chmac's solution. –  jrg Jun 1 '12 at 19:56
1  
good answer, but it didn't work for me without the .tmux.conf changes –  Brenden Nov 9 '13 at 6:01

In my ~/.zshrc

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

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

share|improve this answer
    
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 at 10:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.