On Tue, 15 Mar 2022 23:43:58 -0700, akspecs wrote:

> On Tue Mar 15, 2022 at 9:33 PM PDT, Luciano ES wrote:
> > I am using a very old version of fish   
> 
> what version of fish are you using?
> 
> > I have this in my config.fish file:
> >
> > function fish_command_not_found --on-event fish_command_not_found
> >     if test $argv = "kickball"
> >             echo "goal!"
> >     else
> >             echo Ooops! $argv
> >     end
> > end
> >
> > Testing it:
> >
> > $ sdfg
> > Ooops! sdfg
> > fish: Unknown command 'sdfg'
> >
> > $ kickball
> > goal!
> > fish: Unknown command 'kickball'
> >
> > It works, but I don't want fish to print that last 'Unknown
> > command' line. Can I turn it off?  
> 
> i was able to test what you have in your config.fish file and i get
> the following:
> 
> $ kickball
> goal!
> $ bam!
> Ooops! bam!
> $ fish --version
> fish, version 3.3.1
> 
> 
> the above looks to be your desired behaviour, so any more recent
> version of fish _should_ do this.
> 
> if you are stuck on an old version of fish, perhaps check out the
> following after commenting out those lines in your config.fish:
> 
> $ functions fish_command_not_found
> 
> 
> based on the output of that command, you'll likely see if it calls the
> handler which in my case points to:
> 
> __fish_default_command_not_found_handler
> 
> run the same on that:
> 
> $ functions __fish_default_command_not_found_handler
> 
> 
> ideally, unless your fish version is truly ancient, this will show you
> where your __fish_default_command_not_found_handler is defined, in
> which case you can try editing *that* file if you must (consider
> backing it up first in case) to get your desired behaviour.
> 
> best,
> ak

************************

Hi.

I tried your suggestion and got this:

$ functions fish_command_not_found
# Defined in /home/luc/.config/fish/config.fish @ line 16
function fish_command_not_found --on-event fish_command_not_found
        if test $argv = "kickball"
                echo "goal!"
        else
                echo Ooops! $argv
        end
end


No other handler.

I also scanned the hard disk in search of files named ".*fish.*handler.*"
and found none.

I am using 2.7.1. My distro version has 3.0.2, but I have fish 
scripts all over the place and I'm afraid of breaking compatibility
or losing my customizations.


Luciano ES
>>


_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to