2015-07-09 10:54:49 +08:00
|
|
|
function dirs --description 'Print directory stack'
|
2016-11-28 13:27:22 +08:00
|
|
|
# process options
|
2017-01-05 09:05:18 +08:00
|
|
|
if set -q argv[1]
|
2016-11-28 13:27:22 +08:00
|
|
|
switch $argv[1]
|
|
|
|
case -c
|
|
|
|
# clear directory stack
|
|
|
|
set -e -g dirstack
|
|
|
|
return 0
|
2015-07-09 10:54:49 +08:00
|
|
|
end
|
2016-11-28 13:27:22 +08:00
|
|
|
end
|
2006-02-12 21:14:21 +08:00
|
|
|
|
2016-11-28 13:27:22 +08:00
|
|
|
# replace $HOME with ~
|
2017-01-05 09:05:18 +08:00
|
|
|
string replace -r '^'"$HOME"'($|/)' '~$1' -- $PWD $dirstack | string join " "
|
2016-11-28 13:27:22 +08:00
|
|
|
echo
|
2015-07-09 10:54:49 +08:00
|
|
|
end
|