fish-shell/share/functions/dirs.fish

21 lines
460 B
Fish
Raw Normal View History

function dirs --description 'Print directory stack'
set -l options h/help c
2017-07-14 02:53:29 +08:00
argparse -n dirs --max-args=0 $options -- $argv
or return
if set -q _flag_help
__fish_print_help dirs
return 0
end
if set -q _flag_c
# Clear directory stack.
set -e -g dirstack
return 0
end
2017-07-14 02:53:29 +08:00
# Replace $HOME with ~.
string replace -r '^'"$HOME"'($|/)' '~$1' -- $PWD $dirstack | string join " "
echo
end