diff options
author | axel <axel@liljencrantz.se> | 2006-02-17 20:13:39 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-02-17 20:13:39 +1000 |
commit | 343cafef346543282b5b6e825bc8f9dd10028a48 (patch) | |
tree | 1bcf221ecb525c7aeadc8325e7b780d3656e544b /share/functions/cd.fish | |
parent | 95a01f3c8f15034433ffce368d8f2d13d925139c (diff) |
Redo installation file structure, move lots of things to $PREFIX/share/fish
darcs-hash:20060217101339-ac50b-d93d2c620a4b7f75f05ff461a6edbee001da7613.gz
Diffstat (limited to 'share/functions/cd.fish')
-rw-r--r-- | share/functions/cd.fish | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/share/functions/cd.fish b/share/functions/cd.fish new file mode 100644 index 00000000..e9287c4b --- /dev/null +++ b/share/functions/cd.fish @@ -0,0 +1,35 @@ +# +# The following functions add support for a directory history +# + +function cd -d (_ "Change directory") + + # 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 + |