Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
    
Possible duplicate of How can I make ctrl+left/right keys work right in tmux? – UpAndAdam Feb 24 at 22:01

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

You must log in to answer this question.

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