fork/puffer-fish

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

Julia RyanFix regex8e81dff

quick-substitution
825 B21 linesraw
1function _puffer_fish_expand_caret
2    if commandline --search-field >/dev/null
3        commandline --search-field --insert '^'
4    else
5        set -l current_token (commandline --current-token)
6        if string match --quiet --regex -- '^\^([^^]+)\^([^^]*)$' "$current_token"
7            set -l matches (string match --regex -- '^\^([^^]+)\^([^^]*)$' "$current_token")
8            set -l old $matches[2]
9            set -l new $matches[3]
10            set -l prev_cmd $history[1]
11            if string match --quiet -- "*$old*" "$prev_cmd"
12                set -l expanded (string replace -- "$old" "$new" "$prev_cmd")
13                commandline --current-token -- $expanded
14            else
15                commandline --insert '^'
16            end
17        else
18            commandline --insert '^'
19        end
20    end
21end