how to write function in fish

how to write function in fish

how to write basic functions in fish shell

funced

First off to create a function while in the fish shell we will type "func" and then pass an arguemnt and that will be the function name you desire.

funced test

You can pass these flags for

  • i | interactive mode
  • e | open in external editor
  • s | autosave after succesful edit

    funced -i test
    

    funsave

    Save your function, test your function first to make sure it works.

    funsave test
    

    example functions

    example functions

    mkcd

    make dir and cd into it and also pwd

       mkdir $argv && cd $argv && pwd
    

    gc

    cd into my project folder then git clone a project

      cd projects && git clone $argv
    

    ys

search the aur with yay -s

yay -s $argv

You can now create basic funtions in fish!

here are my git files, check them out! fish-functions on Github