fish-shell/share/functions/cd.fish
axel c9e98c2eef Update function wrapper for cd builtin, make sure a local variable is used
darcs-hash:20060617131145-ac50b-1cef97b5e774713f659962b7e33f889be3081a3d.gz
2006-06-17 23:11:45 +10:00

37 lines
613 B
Fish

#
# The following functions add support for a directory history
#
function cd -d (N_ "Change directory")
# Skip history in subshells
if status --is-command-substitution
builtin cd $argv
return $status
end
# Avoid set completions
set -l previous $PWD
if test $argv[1] = - ^/dev/null
if test $__fish_cd_direction = next ^/dev/null
nextd
else
prevd
end
return $status
end
builtin cd $argv[1]
set -l cd_status $status
if test $cd_status = 0 -a $PWD != $previous
set -g dirprev $dirprev $previous
set -e dirnext
set -g __fish_cd_direction prev
end
return $cd_status
end