diff --git a/.config/fish/conf.d/smartcd.fish b/.config/fish/conf.d/smartcd.fish index fcb067c8..a3a7d44b 100644 --- a/.config/fish/conf.d/smartcd.fish +++ b/.config/fish/conf.d/smartcd.fish @@ -7,6 +7,11 @@ if not functions -q __cd_orig end function cd --wraps=cd --description "Change directory. No args goes to git root or $HOME. If already there, return to previous location." + # Skip history in subshells. + if status --is-command-substitution + builtin cd $argv + return $status + end git rev-parse --is-inside-work-tree &>/dev/null set -l is_git $status if test (count $argv) -ne 0 @@ -24,3 +29,9 @@ function cd --wraps=cd --description "Change directory. No args goes to git root end end end + +function smartcd_update --description "Update smartcd.fish with the latest from the upstream." + curl https://git.sr.ht/~ficd/smartcd.fish/blob/main/smartcd.fish \ + -o $fish_config/conf.d/smartcd.fish + exec fish +end