If I put a file called myfunc.fish in a directory called functions, and it includes a single function called myfunc, then fish will locate it if I type myfunc as a command.
What about if I want to have a bunch of short functions in one file? How do I "include" them?
source
is how you include files.
Say you have a collection of functions thing1
, thing2
, etc. in a single file ~/mystuff/things.fish
that you want to make available. Two good approaches are:
You can use the autoloading machinery: make the files functions/thing1.fish
, functions/thing2.fish
, etc. each with the same contents:
source ~/mystuff/things.fish
But a simpler approach is to just put that source
line into your ~/.config/fish/config.fish
file. Then it will be executed for each session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With