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