fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
0eb17fa58
master
1# localization: tier1 2# 3# Wrap the builtin cd command to maintain directory history. 4# 5function cd --description"Change directory" 6set -l MAX_DIR_HIST25 7 8# Skip history in subshells. 9if status is-command-substitution 10builtin cd$argv 11return $status 12end 13 14# Avoid set completions. 15set -l previous$PWD 16 17if test " $argv " = - 18if test " $__fish_cd_direction " = next 19nextd 20else 21prevd 22end 23return $status 24end 25 26builtin cd$argv 27set -l cd_status$status 28 29if test $cd_status -eq 0 -a " $PWD " != " $previous " 30set -q dirprev 31or set -l dirprev 32set -q dirprev[ $MAX_DIR_HIST ] 33and set -e dirprev[ 1 ] 34 35# If dirprev, dirnext, __fish_cd_direction 36# are set as universal variables, honor their scope. 37 38set -U -q dirprev 39and set -U -a dirprev$previous 40or set -g -a dirprev$previous 41 42set -U -q dirnext 43and set -U -e dirnext 44or set -e dirnext 45 46set -U -q __fish_cd_direction 47and set -U __fish_cd_direction prev 48or set -g __fish_cd_direction prev 49end 50 51return $cd_status 52end