-1

I recently installed various fisher plugins and updated to fish 3.4.1 and now "ctrl-p" does not cycle through my commands anymore, but ARROW UP is still working. When I switch to the bash shell, ctrl-p is working. I observe the same behaviour in the gnome terminal and kitty terminal. I have no clue what the problem is and would appreciate a lot if someone could help me, thanks in advance!

Sebastian
  • 865
  • 5
  • 13

1 Answers1

1

It appears one of your plugins rebound ctrl-p.

In general, to find out what a key sequence is bound to, you need to:

  1. Figure out what the key sequence is by starting fish_key_reader and pressing it
  2. Pass that to bind

So, you run fish_key_reader, which tells you:

bind \cP 'do something'

That means ctrl-p sends \cP.

So, we ask what \cP is bound to:

bind \cP

which by default gives us

bind --preset \cp up-or-search

(yes, the case is indeed irrelevant after a \c as \cp and \cP encode the same).

And if you had bound something differently, it might print multiple lines like

bind --preset \cp up-or-search
bind \cp 'echo oops'

What can also happen here is that one of your plugins enabled vi-mode (this can happen even for things you might think are entirely unrelated, for instance there's at least one semi-popular prompt that believes it's entitled to enable it).

In that case, bind \cP will output nothing, and you can also ask bind -M insert \cP to ask what ctrl-p is bound to in insert mode.

To disable vi-mode and go back to the default emacs-inspired bindings (where that binding for ctrl-p originated), run fish_default_key_bindings.

faho
  • 14,470
  • 2
  • 37
  • 47
  • Thanks! I enabled vi-mode myself and I did not understand that I have to run `fish_default_key_bindings` again (I only removed `fish_vi_key_bindings` from the config.fish) – Sebastian May 02 '22 at 13:20
  • 1
    By default, fish will show a mode-indicator when you're running in vi-mode. That's a green `[I]` or red `[N]` in front of the prompt. Most likely your prompt disables it again - which removes valuable information. – faho May 02 '22 at 13:54
  • 1
    Also: Most fish questions are probably better suited for unix.stackexchange.com - there are some users here who like to close all questions that aren't strictly about programming, and when it's about fish the boundary is sometimes unclear. – faho May 02 '22 at 13:56