How can I make ctrl+left/right keys to move by whole word in tmux?

  1. Edit your ~/.tmux.conf and add lines:

    set-window-option -g xterm-keys on
    
  2. If you don’t want to make it permanent just yet, do:

    C-b :set-window-option xterm-keys on
    
  3. Reload your config in tmux by doing:

    C-b :source-file ~/.tmux.conf
    

More information here:


set-window-option -g xterm-keys on

Got me some of the way there and gave me Ctrl-Left/Right on the console, but it was still responding differently in vim.

Unbinding the keys didn't seem to help.

It turned out that at some point I had set my default terminal to screen (set-option -g default-terminal "screen" in .tmux.conf)

Changing this to the following gave me Ctrl-Left/Right in everything else:

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

Hope that helps somebody.


For msys2/Cygwin/mintty:

Add below to ~/.inputrc.

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

Reload would make tmux work correctly.