12

When using tmux within Mobaxterm, Ctrl + Left/Right just moves the cursor forward/back one character, not one word.

In the following cases, Ctrl + Left/Right does behave as expected:

  • in bash within Mobaxterm
  • in screen within Mobaxterm
  • in tmux within Cygwin
  • in screen or bash within Cygwin

So it seems to be an issue only when combining tmux with Mobaxterm.

In all cases, I am ssh-ing to a remote linux machine, within either Cygwin or Mobaxterm. My /etc/inputrc is set as it should for the shortcuts to work.

Any clue?

1 Answer 1

18

Old question. But in case someone find his way here. This is sgzmd's answer:

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

set-window-option -g xterm-keys on

If you don’t want to make it permanent just yet, do:

C-b :set-window-option xterm-keys on

Reload your config in tmux by doing:

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

It worked for me.

original answer here

3
  • 2
    This fixed the behavior in bash, but to also get the shortcuts to work under emacs in tmux, I had to use Kieran Moore's answer in the original answer you referred to: set-option -g default-terminal "xterm-256color"
    – leilu
    Commented Jul 30, 2015 at 2:41
  • This didn;t work for me on macos. I am sshing into a remote mac, and Meta left/right prints ;3D ;#C
    – SFbay007
    Commented Apr 17, 2020 at 21:55
  • To use ctrl + arrow inside tmux and Windows Terminal add set-option -g default-terminal "xterm-256color" to ~/.tmux.conf
    – klapshin
    Commented Nov 29, 2021 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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