How to define an alias in fish shell?

前端 未结 10 604
星月不相逢
星月不相逢 2020-12-07 06:56

I would like to define some aliases in fish. Apparently it should be possible to define them in

~/.config/fish/functions

but they don\'t g

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 07:32

    Just use alias. Here's a basic example:

    # Define alias in shell
    alias rmi "rm -i"
    
    # Define alias in config file
    alias rmi="rm -i"
    
    # This is equivalent to entering the following function:
    function rmi
        rm -i $argv
    end
    
    # Then, to save it across terminal sessions:
    funcsave rmi
    

    This last command creates the file ~/.config/fish/functions/rmi.fish.

    Interested people might like to find out more about fish aliases in the official manual.

提交回复
热议问题