fork/fish-shell

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

Collin StylesDon't escape tildes that come from custom completions4a3e55f69

master
754 B23 linesraw
1function __fish_cdh_args
2    set -l all_dirs $dirprev $dirnext
3    set -l uniq_dirs
4
5    # This next bit of code doesn't do anything useful at the moment since the fish pager always
6    # sorts, and eliminates duplicate, entries. But we do this to mimic the modal behavor of `cdh`
7    # and in hope that the fish pager behavior will be changed to preserve the order of entries.
8    for dir in $all_dirs[-1..1]
9        if not contains $dir $uniq_dirs
10            set uniq_dirs $uniq_dirs $dir
11        end
12    end
13
14    for dir in $uniq_dirs
15        set -l home_dir (string match -r "$HOME(/.*|\$)" "$dir")
16        if set -q home_dir[2]
17            set dir "~$home_dir[2]"
18        end
19        echo $dir
20    end
21end
22
23complete -c cdh -kxa '(__fish_cdh_args)'