Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have tmux command key as C-a. C-Left/C-Right to jump between words (or whatever it is called) works just fine in urxvt alone, but under urxvt/tmux it'll print '5D' and '5C' for Left/Right respectively. How do I configure tmux so word skipping works (either with on X with urxvt or in a tty)?

share|improve this question
    
What program are you typing the C-Left and C-Right into? If it is a shell, which shell it is? Does its configuration have any bindings (i.e. bind in bash and bindkey in zsh)? What TERM are you using inside your tmux panes? –  Chris Johnsen Mar 12 '13 at 6:22

3 Answers 3

Excerpt from Ctrl-left and Ctrl-right in bash and Emacs:

Sometimes the small things make a big difference. I noticed that the control-left 
and control-right keys weren’t working in bash or Emacs on my FreeBSD box 
accessed over X11.app on OS X. Easily fixed.

.inputrc

    "\e[1;5C": forward-word     # Ctrl+right  => forward word
    "\e[1;5D": backward-word    # Ctrl+left   => backward word

.emacs

    (global-set-key "\M-[1;5C"    'forward-word)  ; Ctrl+right   => forward word
    (global-set-key "\M-[1;5D"    'backward-word) ; Ctrl+left    => backward word
  • I guess you'd need to do that in each programs and change their key bindings.
  • I don't know why tmux mangles the keystrokes going through though.
share|improve this answer

If you use zsh, add this to your ~/.zshrc

bindkey "5C" forward-word
bindkey "5D" backward-word

Got it from http://clock.co.uk/blog/zsh-ctrl-left-arrow-outputting-5d

share|improve this answer

Answered here: http://superuser.com/a/395273/65499

C-b :set-window-option xterm-keys on
share|improve this answer

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.