3

When I write a command that does not exist in the fish shell (let's say l instead of ls), fish takes some time before responding that the command does not exist.

I don't know if it looks for package to install or something else, but it is a bit annoying and I need to hit Ctrl-C to avoid waiting a few seconds.

Is there a way to disable this "feature", whatever it is?

antoyo
  • 443

3 Answers3

5

As ridiculous_fish says, this is probably due to the command-not-found handler.

You can try adding this suggestion to your config.fish:

function __fish_default_command_not_found_handler --on-event fish_command_not_found
  functions --erase __fish_command_not_found_setup
  echo "'$argv' not found"
end
Zanchey
  • 1,312
  • Thanks. With this function, I get the message twice, but I does not solve the issue (it is as slow as before). At first, I thought that it could take some time to look in $PATH, but the syntax highlighting is quick, so I am not sure it could causes this issue. What else could cause this issue? – antoyo Oct 29 '15 at 02:24
  • You could run fish under strace and see what it's blocking on. – Zanchey Oct 29 '15 at 09:05
  • One noticeable difference when running strace is that I see more select(8, [7], NULL, NULL, {0, 10000}) = 0 (Timeout) when it is slower. What does it mean? – antoyo Oct 30 '15 at 14:12
  • Could you open an issue on Github and we can try to get to the bottom of it? – Zanchey Oct 31 '15 at 11:53
  • 1
    That was indeed the solution. For some reason, fish did not load it correctly the first time I tried this solution. After a reboot, everything is fine. Thanks. – antoyo Nov 01 '15 at 04:46
1

Since the other answer does not work anymore, I found another solution which consists of adding this function in config.fish:

function __fish_command_not_found_handler --on-event fish_command_not_found
    echo "fish: Unknown command '$argv'"
end
antoyo
  • 443
0

There is a streamlined, documented and hopefully long-term supported way to override this by declaring custom fish_command_not_found function.

~/.config/fish/functions/fish_command_not_found.fish:

function fish_command_not_found
    echo "fish: Unknown command '$argv'" >&2
end

http://fishshell.com/docs/current/cmds/fish_command_not_found.html