fish: add path search function
This commit is contained in:
parent
f9559f904e
commit
f2bc669b21
13
fish/functions/path_search.fish
Normal file
13
fish/functions/path_search.fish
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
function path_search --description "Search your path for an executable"
|
||||||
|
set --local loc (echo $PATH | tr ' ' '\n' | eval "fzf $FZF_DEFAULT_OPTS --header='[find:path]'")
|
||||||
|
|
||||||
|
if test (count $loc) = 1
|
||||||
|
set --local cmd (rg --files -L $loc | rev | cut -d'/' -f1 | rev | tr ' ' '\n' | eval "fzf $FZF_DEFAULT_OPTS --header='[find:exe] => $loc'")
|
||||||
|
if test (count $cmd) = 1
|
||||||
|
echo $cmd
|
||||||
|
else
|
||||||
|
path_search
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user