mirror of
https://github.com/ViViDboarder/shoestrap.git
synced 2024-11-21 21:26:31 +00:00
Add function to be used for experimental fish-fzf completion
This commit is contained in:
parent
c14d734137
commit
e74d5adc66
16
assets/default/fish/functions/__fzf_complete.fish
Normal file
16
assets/default/fish/functions/__fzf_complete.fish
Normal file
@ -0,0 +1,16 @@
|
||||
function __fzf_complete --description "Prints values passed as args or through stdin for completion through fzf, if available. This can be disabled by using ENABLE_FZF_COMPLETE"
|
||||
set -l cmd ""
|
||||
if count $argv > /dev/null
|
||||
set cmd "string split ' ' $argv"
|
||||
else
|
||||
set cmd "cat"
|
||||
end
|
||||
|
||||
# Make fzf completion opt-in
|
||||
if type -q fzf ;and [ -n $ENABLE_FZF_COMPLETE ]
|
||||
set -l last_arg (string trim (commandline -t))
|
||||
eval $cmd | fzf --query=$last_arg -d " " --exit-0 --select-1 --height 40% --min-height 10 --reverse
|
||||
else
|
||||
eval $cmd
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user