How can I make ctrl+left/right keys to move by whole word in tmux?
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Take control of your privacy with Proton's trusted, Swiss-based, secure services.
Choose what you need and safeguard your digital life:
Mail: https://go.getproton.me/SH1CU
VPN: https://go.getproton.me/SH1DI
Password Manager: https://go.getproton.me/SH1DJ
Drive: https://go.getproton.me/SH1CT
Music by Eric Matyas
https://www.soundimage.org
Track title: Future Grid Looping
--
Chapters
00:00 How Can I Make Ctrl+Left/Right Keys To Move By Whole Word In Tmux?
00:22 Answer 1 Score 3
00:55 Accepted Answer Score 150
01:17 Answer 3 Score 14
01:48 Answer 4 Score 3
02:01 Thank you
--
Full question
https://superuser.com/questions/360832/h...
--
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.