- 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://get.oh-my.fish | fish
sudo bash -c 'echo $(which fish) >> /etc/shells'
chsh -s $(which fish)
# shortcuts
alias .. "cd .."
alias cd.. "cd .."
alias ll "ls -la"
# modern tooling (see https://github.com/ibraheemdev/modern-unix)
alias ls exa
alias cat bat
# typos
alias gti git
Add 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
end
Quickly access your DropBox folder
function db
set user $HOME
cd "$HOME/Dropbox"
end
Quickly access your iCloud Drive folder
function icd
set user $HOME
cd "$HOME/Library/Mobile\ Documents/com\~apple\~CloudDocs"
end
Quickly access your documents folder
function docs
switch (uname -s)
case Darwin Linux FreeBSD NetBSD DragonFly
set documents $HOME/Documents
case '*'
set cygwin (eval uname -o)
if test $cygwin = "Cygwin"
set documents (eval cygpath -O)
end
return
end
cd $documents
end
end
Return platform name
function os
switch (uname -s)
case Darwin Linux FreeBSD NetBSD DragonFly
eval command uname -s
case "*"`
switch (uname -s)
case Cygwin
eval command uname -s
case "*"
eval echo "undefined"
end
end
end
Simplify the creation and deletion of Git tags
function tag
if count $argv > /dev/null
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
else
# list tags
command git tag
end
end
There are plenty of guides on how to get nvm
running in Fish. This is the one that works for me.
- Install
bass
- Add the following to
config.fish
# This is what you often find online...
function nvm
bass source (brew --prefix nvm)/nvm.sh --no-use ';' nvm $argv
end
# ...however, for me it doesn't work without the following line
set -Ux NVM_DIR ~/.nvm
echo /usr/local/bin/fish >> /etc/shells
gives me a: