How can I make ctrl+left/right keys to move by whole word in tmux?
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puddle Jumping Looping
--
Chapters
00:00 Question
00:30 Accepted answer (Score 147)
01:02 Answer 2 (Score 12)
01:49 Answer 3 (Score 4)
02:26 Answer 4 (Score 3)
02:47 Thank you
--
Full question
https://superuser.com/questions/360832/h...
Accepted answer links:
[here]: http://www.sigizmund.com/2012/02/tmux-an...
Answer 3 links:
[image]: https://i.stack.imgur.com/uAC1E.png
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#keyboardshortcuts #tmux
#avk47
ACCEPTED ANSWER
Score 150
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
More information here:
ANSWER 2
Score 14
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.
ANSWER 3
Score 3
I'm not sure, but this might be because tmux
by default binds C-<up/down/left/right>
to shift the focus onto the pane above/below/left of/right of the currently focused pane. If you don't use panes often, you might not have noticed this feature. If this is what the problem is, you can unbind those keys by saying:
unbind C-Left
unbind C-Right
That might be enough on it's own, or you might need to manually bind them again to what you want them to do, via:
bind -n C-Left <the action you want>
bind -n C-Right <other action you want>
ANSWER 4
Score 3
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.