Skip to content

Instantly share code, notes, and snippets.

@ivansaul
Last active February 21, 2021 03:21
Show Gist options
  • Save ivansaul/08166a29d84d67016bdf866c6c1e3251 to your computer and use it in GitHub Desktop.
Save ivansaul/08166a29d84d67016bdf866c6c1e3251 to your computer and use it in GitHub Desktop.
Create alias in Fish shell and save this as a permanent.

First method

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.

Second method

I prefer this method so that I can easily edit my aliases in a single file.

  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. source ~/.config/fish/config.fish

Enjoy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment