l fzfmenu: show query if no match

This commit is contained in:
lassulus 2020-04-14 19:49:00 +02:00
parent 1ed6cb7168
commit 843a537bd7

View File

@ -32,14 +32,24 @@ pkgs.writeDashBin "fzfmenu" ''
done done
INPUT=$(${pkgs.coreutils}/bin/cat) INPUT=$(${pkgs.coreutils}/bin/cat)
OUTPUT="$(${pkgs.coreutils}/bin/mktemp)" OUTPUT="$(${pkgs.coreutils}/bin/mktemp)"
${pkgs.rxvt_unicode}/bin/urxvt \ if [ -z ''${TERM+x} ]; then #check if we can print fzf in the shell
-name fzfmenu -title fzfmenu \ ${pkgs.rxvt_unicode}/bin/urxvtc \
-e ${pkgs.dash}/bin/dash -c \ -name fzfmenu -title fzfmenu \
"echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \ -e ${pkgs.dash}/bin/dash -c \
--history=/dev/null \ "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \
--print-query \ --history=/dev/null \
--prompt=\"$PROMPT\" \ --print-query \
> \"$OUTPUT\"" 2>/dev/null --prompt=\"$PROMPT\" \
--reverse \
> \"$OUTPUT\"" 2>/dev/null
else
echo "$INPUT" | ${pkgs.fzf}/bin/fzf \
--history=/dev/null \
--print-query \
--prompt="$PROMPT" \
--reverse \
> "$OUTPUT"
fi
${pkgs.coreutils}/bin/tail -1 "$OUTPUT" ${pkgs.coreutils}/bin/tail -1 "$OUTPUT"
${pkgs.coreutils}/bin/rm "$OUTPUT" ${pkgs.coreutils}/bin/rm "$OUTPUT"
'' ''