Add abbreviations in fish config
Sorry, I'm not sure if I understand what you're asking. But if your question is how to set your abbr
definitions on startup (and in a file that you can store in a repository and share between machines), you should use the file ~/.config/fish/config.fish
which is Fish's equivalent to .bashrc
in Bash.
Since abbreviations are stored in global/universal variables, they don't need to be reset every time you open a terminal window, so you can place a safeguard in that config file to prevent resetting them every time (speeding things up a bit), as explained here:
https://github.com/fish-shell/fish-shell/issues/1976#issuecomment-168698602
Edit (April 2019):
After Fish changed the way universal variables are stored in version 3.0.0 the safeguard functionality seems to prevent changes made in the abbr list to be included also after opening new terminal windows or rebooting one's machine. So, I've removed those lines from the example.
E.g. my config.fish
looks like this (for Git commands):
echo -n Setting abbreviations...
abbr g 'git'
abbr ga 'git add'
abbr gb 'git branch'
abbr gbl 'git blame'
abbr gc 'git commit -m'
abbr gca 'git commit --amend -m'
abbr gco 'git checkout'
abbr gcp 'git cherry-pick'
abbr gd 'git diff'
abbr gf 'git fetch'
abbr gl 'git log'
abbr gm 'git merge'
abbr gp 'git push'
abbr gpf 'git push --force-with-lease'
abbr gpl 'git pull'
abbr gr 'git remote'
abbr grb 'git rebase'
abbr gs 'git status'
abbr gst 'git stash'
echo 'Done'