From 6ed4d3a32d69cf3505e24fb94772fff906cd8190 Mon Sep 17 00:00:00 2001 From: Eduard Tolosa Date: Thu, 5 Jun 2025 00:18:38 -0500 Subject: [PATCH] (chore): optimize fzf popup --- functions/__based_fzf_popup.fish | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/functions/__based_fzf_popup.fish b/functions/__based_fzf_popup.fish index 127e956..736256a 100644 --- a/functions/__based_fzf_popup.fish +++ b/functions/__based_fzf_popup.fish @@ -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