Quantcast
Channel: Active questions tagged fish - Stack Overflow
Viewing all articles
Browse latest Browse all 106

How to override (decorate) a builtin fish function

$
0
0

I would like to silence the printf that is found on line 9 of /usr/share/fish/functions/__fish_move_last.fish because I find it annoying.

How can I do that without copying the entire function over?

If I just copy the file to ~/.config/fish/functions/ and comment line 9, I could break things when the original function gets updated in a new release.

I would rather silence the function with something like this:

functions -c __fish_move_last __fish_move_last_ORIGfunction __fish_move_last    __fish_move_last_ORIG $argv >/dev/nullend

But if I place that snippet in ~/.config/fish/functions/__fish_move_last.fish, I get this error:

fish: Could not autoload item '__fish_move_last', it is already being autoloaded. This is a circular dependency in the autoloading scripts, please remove it.

I tried loading the original function explicitly at the beginning of the file, to avoid autoloading, but it did not make the error go away:

source /usr/share/fish/functions/__fish_move_last.fishfunctions -c __fish_move_last __fish_move_last_ORIGfunction __fish_move_last    __fish_move_last_ORIG $argv >/dev/nullend

What is the correct approach here?


Viewing all articles
Browse latest Browse all 106

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>