Fzf: execute with current input if no available matches

Created on 24 Dec 2019  路  3Comments  路  Source: junegunn/fzf

  • [X] I have read through the manual page (man fzf)
  • [X] I have the latest version of fzf
  • [X] I have searched through the existing issues

Info

  • OS

    • [X] Linux

    • [ ] Mac OS X

    • [ ] Windows

    • [ ] Etc.

  • Shell

    • [X] bash

    • [ ] zsh

    • [ ] fish

Problem / Steps to reproduce

  1. printf 'foo\nbar' | fzf --bind 'enter:execute(echo {})'

  2. typing test

  3. press enter

expect test being echoed

actual the execute action isn't executed at all.

Can we have an execute variant that runs no matter if there is a selected candidate?

question tip

Most helpful comment

If the command template contains {q}, the action will trigger even when {} is null.

printf 'foo\nbar' | fzf --bind 'enter:execute(echo {}/{q}; sleep 1)'

All 3 comments

If the command template contains {q}, the action will trigger even when {} is null.

printf 'foo\nbar' | fzf --bind 'enter:execute(echo {}/{q}; sleep 1)'

Sorry for the necro, but is there a way to automatically exit with 0 status in this situation? I've tried the -0 flag, and also

$ printf 'foo\nbar' | fzf --bind 'enter:execute(echo {}/{q}; exit 0)'

You can use --print-query and process the output using shell script.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

asilvadesigns picture asilvadesigns  路  3Comments

lbeier picture lbeier  路  3Comments

ahmedelgabri picture ahmedelgabri  路  3Comments

jberglinds picture jberglinds  路  3Comments

alistaircolling picture alistaircolling  路  3Comments