-1

When I use my Fish Shell on Linux Mint, using the Ctrl+Left or Ctrl+Right keys isn't moving the cursor to the previous or next word. It switches between an I and an N instead:

Here is the I and then the N:

Here is the I and then the N

I cannot do partial completion then, so it's really boring.

How can I fix this?

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264

1 Answers1

1

Glenn Jackman's comment is correct - you are using vi-mode.

Some third-party prompts (e.g. from Oh-My-Fish or similar) enable it for some reason.

To switch back, usually executing fish_default_key_bindings once interactively should suffice once you have deleted the offending line or package (search for fish_vi_key_bindings).


Or, if you like vi-mode, you can add a binding. Create a function called fish_user_key_bindings (e.g. with funced).

The content should look like this

function fish_user_key_bindings
    bind -M $mode $sequence $command
end

where "$command" here would be "backward-word". $mode would be the vi-mode you want the binding to be valid for, e.g. "insert" or "default" (what vi would call "normal" mode).

"$sequence" would be the text sequence that the terminal sends to fish whenever this key combination is pressed. Unfortunately they aren't standardized, so you need to figure out which it is on your system.

fish_key_reader is useful here - execute it, press the combination and use what it tells you. On my terminal ctrl+left sends \e\[1\;5D (and ctrl+right sends the same with C instead of D).

faho
  • 14,470
  • 2
  • 37
  • 47