1

I'm using Terminator which is Terminal Emulator and I want to add CTRL + Arrows shortcut instead of Alt + b or Alt +c

1
  • It can be done in shell config file, like ~/.bashrc or ~/.zshrc (tell me which shell you use first, please). If it's for Bash or Zsh, I can do it. Jan 14, 2022 at 23:16

1 Answer 1

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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