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