13

I do not know why, but after making a whole bunch of fish aliases. I'm assuming I have neglected one simple step after assigning them all but I cannot seem find the solution myself.

Can anyone lend me a hand?

Thank you very much!

~Ev

Ev-
  • 619
  • 1
  • 5
  • 15

2 Answers2

28

A fish alias is actually implemented as a function. To save a function, you need funcsave. So this is the sequence

alias foo=bar
funcsave foo

That creates ~/.config/fish/functions/foo.fish which will then be available in any fish session.

The alias command also works without the =:

alias foo "bar baz qux"
glenn jackman
  • 84,176
  • 15
  • 116
  • 168
  • @MrNycticorax, the alias syntax without the = [goes way back in fish](https://fishshell.com/docs/2.0/commands.html#alias) – glenn jackman Jun 02 '21 at 14:37
11

It basically boiled down to:

  1. Open ~/.config/fish/config.fish in your favorite editor. If it's not already there, it'll make it for you. (Don't su it though.)
  2. Add all the aliases you want. It'll save them and always load then because this is apparently Fish's version of bashrc.
  3. Save it, baby!
  4. Enjoy.
slm
  • 363,520
  • 117
  • 767
  • 871
Ev-
  • 619
  • 1
  • 5
  • 15