Search code examples
gitfish

How do I use fish shell functions in abbreviations?


Say I have the following git_branch_name function:

$ echo git_branch_name
master

$ git pull origin (git_branch_name) // Pulls origin master

How could I use that function within an abbreviation?

Here is what I have tried:

abbr -a ggl git pull origin (git_branch_name)

Unfortunately this interpolates (git_branch_name) during the definition of the abbreviation.


Solution

  • If you want to defer the substitution just quote it when defining the abbreviation:

    abbr -a ggl 'git pull origin (git_branch_name)'