diff --git a/.config/fish/conf.d/smartcd.fish b/.config/fish/conf.d/smartcd.fish index 198752ca..f91c6e87 100644 --- a/.config/fish/conf.d/smartcd.fish +++ b/.config/fish/conf.d/smartcd.fish @@ -24,11 +24,17 @@ function cd --wraps=cd --description "Change directory. No args goes to git root end if not test (pwd) = $root __cd_orig $root - else + else if set -q dirprev echo "prev: $dirprev[-1] root: $root" - if string match -q "$root" "$dirprev[-1]" + set -x smartdirprev $dirprev[-1] + set -x smartroot $root + if string match -q "$root*" "$dirprev[-1]" + echo We out here __cd_orig - + else + set -l prompt "This would take you to $dirprev[-1], which is outside $root, are you sure? (y/n): " + echo $prompt end end end