fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Nahorcolor: prefer `set_color --reset` over `set_color normal`867946468

master
878 B32 linesraw
1# localization: tier1
2function dirh --description "Print the current directory history (the prev and next lists)"
3    set -l options h/help
4    argparse -n dirh --max-args=0 $options -- $argv
5    or return
6
7    if set -q _flag_help
8        __fish_print_help dirh
9        return 0
10    end
11
12    set -l dirc (count $dirprev)
13    if test $dirc -gt 0
14        set -l dirprev_rev $dirprev[-1..1]
15        # This can't be (seq $dirc -1 1) because of BSD.
16        set -l dirnum (seq 1 $dirc)
17        for i in $dirnum[-1..1]
18            printf '%2d) %s\n' $i $dirprev_rev[$i]
19        end
20    end
21
22    echo (set_color $fish_color_history_current)'   ' $PWD(set_color --reset)
23
24    set -l dirc (count $dirnext)
25    if test $dirc -gt 0
26        set -l dirnext_rev $dirnext[-1..1]
27        for i in (seq $dirc)
28            printf '%2d) %s\n' $i $dirnext_rev[$i]
29        end
30    end
31    echo
32end