fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
ce245704d
master
1function __fish_complete_pushd_plus 2if count $dirstack > /dev/null 3# print each member of the stack, replace $HOME with ~ 4for iin ( seq ( count $dirstack )) 5printf "+%s\t%s\n" $i "Rotate to " ( string replace -r"^ $HOME " "~" --$dirstack [ $i ]) 6end 7end 8end 9 10function __fish_complete_pushd_minus 11if count $dirstack > /dev/null 12# print each member of the stack, replace $HOME with ~ 13# Negative arguments are expected to start at "-0" 14for iin ( seq ( count $dirstack ) -1 1 ) 15printf "%s\t%s\n" -( math $i -1 ) "Rotate to " ( string replace -r"^ $HOME " "~" --$dirstack [( math -$i )]) 16end 17end 18end 19 20function __fish_complete_pushd_swap 21if count $dirstack > /dev/null 22# replace $HOME with ~ 23printf "\t%s\n" "Swap with " ( string replace -r"^ $HOME " "~" --$dirstack [ 1 ]) 24end 25end 26 27# support pushd <dir> 28complete -c pushd -a"(__fish_complete_cd)" 29 30# support pushd <> 31complete -c pushd -a'(__fish_complete_pushd_swap)' 32 33# support pushd <+n> 34complete -c pushd -a'(__fish_complete_pushd_plus)' 35complete -c pushd -a'(__fish_complete_pushd_minus)'