#
fish snippet: improved “i was lucky” fish function
now the function will use the last search within the last 20 executed commands.
function iwaslucky
set search (for i in (seq 20); echo $history[$i]; end | grep "^mlocate\|^grep -rl")[1]
echo iwaslucky: using \"$search\"
open (eval (echo $search))[1]
end
where could this improve? the script could adjust the history range if no searches were found when it tried to detect them. it could allow a more flexible use of grep. it could try to use the last search that indeed returned results.
maybe some other day.
This was posted 1 year ago. Notes.