# Defined via `source` function cd --wraps=cd --description "Change directory. No args goes to git root or $HOME." set -l cdfunc /usr/share/fish/functions/cd.fish if test (count $argv) -ne 0; or not git rev-parse --is-inside-work-tree &>/dev/null source $cdfunc cd $argv else source $cdfunc cd (git rev-parse --show-toplevel) end end