mirror of
https://github.com/edu4rdshl/based.fish.git
synced 2026-07-17 23:24:46 +00:00
(chore): optimize fzf popup
This commit is contained in:
parent
d7c44fae63
commit
6ed4d3a32d
1 changed files with 11 additions and 14 deletions
|
|
@ -1,21 +1,18 @@
|
|||
function __based_fzf_popup
|
||||
set -l suggestions (__based)
|
||||
if test (count $suggestions) -gt 0
|
||||
set -l chosen (printf "%s\n" $suggestions | fzf --height 40% --reverse --prompt='Context > ' --query="$prefix" --no-sort --exact --border)
|
||||
set -l chosen (printf "%s\n" (__based) | fzf --height 50% --reverse --prompt='Command > ' --no-sort --exact --border)
|
||||
|
||||
if test -n "$chosen"
|
||||
if test -n "$chosen"
|
||||
set -l cleaned (string trim -- $chosen)
|
||||
if test -n "$cleaned"
|
||||
commandline -r -- "$cleaned"
|
||||
commandline -f repaint
|
||||
# If BASED_NO_CONFIRMATION is set to a non-zero value, execute the command immediately
|
||||
if set -q BASED_NO_CONFIRMATION; and test "$BASED_NO_CONFIRMATION" != 0
|
||||
commandline -f execute
|
||||
end
|
||||
end
|
||||
else
|
||||
commandline -r -- "$chosen"
|
||||
commandline -f repaint
|
||||
return
|
||||
# If BASED_NO_CONFIRMATION is set to a non-zero value, execute the command immediately
|
||||
if set -q BASED_NO_CONFIRMATION; and test "$BASED_NO_CONFIRMATION" != 0
|
||||
commandline -f execute
|
||||
end
|
||||
end
|
||||
else
|
||||
commandline -f repaint
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue