I'm using Terminator
which is Terminal Emulator and I want to add CTRL + Arrows shortcut instead of Alt + b or Alt +c
1 Answer
First step, check if those shortcuts are recognized by your terminal :
type Ctrl + vCtrl + Left or Ctrl + vCtrl + Right on your terminal, and see what it does.
For me, it writes ^[[1;5D
and ^[[1;5C
(where ^[
is just one character, similar to Alt or Escape).
If it writes nothing or something else, it means those shortcuts are already used.
If you are using Bash
, you can add (copy and paste it) to your ~/.bashrc
file :
bind '"\033[1;5D":"\033b"'
bind '"\033[1;5C":"\033c"'
If you are using Zsh
, you can add (copy and paste it) to your ~/.zshrc
file :
bindkey -s '\e[1;5D' '\eb'
bindkey -s '\e[1;5C' '\ec'
It will make Ctrl + Left have the behavior of Alt + b,
and Ctrl + Right have the behavior of Alt + c.
This method is supposed to work with almost every terminal (I tested it with Terminator
to be sure), and mostly depends on your shell.
~/.bashrc
or~/.zshrc
(tell me which shell you use first, please). If it's for Bash or Zsh, I can do it.