Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using terminator along with fish and I want to use Alt-Left etc for navigating terminator and Ctrl-Left and Ctrl-right to move the cursor by word. The problem is when I do

bind \cleft backward-word

it doesn't change the behavior of of Ctrl-left or right. This seems to follow what the documentation and I pulled the key and the command from the -K and -f flags and

bind -a

shows that the bindings exists.

I've used the same command for other sequences, but I can't get this one to work. Am I missing something?

share|improve this question

I fixed it on my end. This goes in the config:

bind \e\[1\;5C forward-word
bind \e\[1\;5D backward-word

"source" it by executing:

. .config/fish/

("." is source in fish)

Hope that helps you!

share|improve this answer
Great! But I'm having a problem getting this to run automatically every time I open a terminal. I don't want to source it manually every time. Is there a way to do it automatically? – Seb Sep 6 '12 at 15:24
@Seb Same here. I don't use fish frequently enough (due to these kinds of issues) for this to have been an issue, so I am still sourcing manually. I would very much like to know, though. You could open a question I guess? – eggonlegs Sep 9 '12 at 18:57
the "~/.bash_profile" for fish is in ~/.config/fish/ (if it doesn't exist create it). To have it run on login do this: if status --is-login bind \e[1\;5C forward-word bind \e[1\;5D backward-word end – Steve Ross Apr 23 '13 at 20:57
Hi, @eggonlegs , is the escape sequence you typed stand for escape + [ + 1 + ; 5 C", this is quite a long sequence. Why use such a long key sequence, isn't it hard to press them all? – richard.g Aug 22 '15 at 1:20

The accepted answer is almost worked, but I found I can't make it auto bind the keys through file. I endup modify the (which under /usr/share/fish/functions) directly.

Also, just adding ctrl-left and ctrl-right to normal mode under vi keybind is not enough, have to add insert and visual mode also.

bind \e\[1\;5C forward-word
bind \e\[1\;5D backward-word
bind -M insert \e\[1\;5C forward-word
bind -M insert \e\[1\;5D backward-word
bind -M visual \e\[1\;5C forward-word
bind -M visual \e\[1\;5D backward-word

Sorry for this should be a comment to the accepted answer, not an independent answer, but due to I don't have sufficient reputation to add comment (personally, I don't think this reputation system is reasonable), and I felt that I should share this to someone who is facing the same issue, or for someone who has experience on how to fix the issue.

share|improve this answer
Worked for me, though I added it to /usr/share/fish/functions/ – metal May 23 at 13:36

The "~/.bash_profile" for fish is in ~/.config/fish/ (if it doesn't exist create it). To have it run on login put this in the file:

if status --is-login
 bind \e\[1\;5C forward-word
 bind \e\[1\;5D backward-word
share|improve this answer

First thing to note is that ctrl+left-arrow doesn't make any sense and can't be done in any shell. That's because the ctrl key doesn't actually send any characters by itself (unless you've done something very unusual to your terminal configuration). What that key does is modify the next letter that is press. For example, ctrl+a causes the terminal to send the single byte hex value 0x01. Since keys such as left-arrow normally send a sequence of characters that begin with the esc character, and escape is already a control character, applying the control modifier to it doesn't do anything.

As you found the usual way to do this is use the alt. If you've configured your terminal to treat that as a "meta" key that prefixes whatever follows with the escape character you can then press alt+page-up to have the terminal send \e\e[5~. If you build fish from git sources you'll get a handy program named fish_key_reader that makes learning what different keys send much easier. That will be in the fish 2.3.1 release which should be available in a couple of weeks.

Lastly, custom key bindings should go in your personal config file, not the global /usr/share/fish/functions/ script. You should create a file named $HOME/.config/fish/functions/ with the following content:

function fish_user_key_bindings
    bind \e\[1\;5C forward-word
    bind \e\[1\;5D backward-word
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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