- Install fish via Brew
- Optionally install Oh My Fish!
- Add fish to known shells
- Set default shell to fish
brew install fish
curl -L https://github.com/bpinto/oh-my-fish/raw/master/tools/install.fish | fish
sudo echo /usr/local/bin/fish >> /etc/shells
chsh -s /usr/local/bin/fishAdd any the following functions to ~/.config/fish/config.fish
Repeat previous command with administrator rights
function sudo
if test "$argv" = !!
eval command sudo $history[1]
else
command sudo $argv
end
endShortcut to browse parent directory
function ..
cd ..
end
And how often did you ever type cd.. instead of cd ..? Let's extend our previous function:
function cd..
.. # or `cd ..`
end
function cd..
..
end
Quickly access your DropBox
function db
set user $HOME
cd "$HOME/Dropbox"
end
Simplify the creation and deletion of Git tags
function tag
if test $argv[1] = "-d"
# delete tag if provided
if test $argv[2]
eval command git tag -d $argv[2]
command git push origin :refs/tags/$argv[2]
end
else
# create new tag and push
eval command git tag -a $argv[1] -m $argv[1]
command git push --tags
end
end