2006-02-08 10:20:43 +00:00
|
|
|
#
|
|
|
|
# The following functions add support for a directory history
|
|
|
|
#
|
|
|
|
|
2006-02-15 17:59:25 +00:00
|
|
|
function cd -d (_ "Change directory")
|
2006-02-08 10:20:43 +00:00
|
|
|
|
|
|
|
# Skip history in subshells
|
|
|
|
if status --is-command-substitution
|
|
|
|
builtin cd $argv
|
|
|
|
return $status
|
|
|
|
end
|
|
|
|
|
|
|
|
# Avoid set completions
|
|
|
|
set previous (command 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]
|
|
|
|
|
|
|
|
if test $status = 0 -a (command pwd) != $previous
|
|
|
|
set -g dirprev $dirprev $previous
|
|
|
|
set -e dirnext
|
|
|
|
set -g __fish_cd_direction prev
|
|
|
|
end
|
|
|
|
|
|
|
|
return $status
|
|
|
|
end
|
|
|
|
|