m/fzf
1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-11-18 08:13:40 -05:00

fzfmenu - handle arguments with quotes passed to fzf

MahouShoujoMivutilde
2020-10-13 23:30:55 +03:00
parent 7679790715
commit c8f6603314

@@ -1468,7 +1468,11 @@ mkfifo $output
chmod 600 $input $output
# it's better to use st here (starts a lot faster than pretty much everything else)
st -c fzfmenu -n fzfmenu -e sh -c "cat $input | fzf $* | tee $output" & disown
# the ugly printf thing is here to make args with quotes work.
# (e.g. --preview='echo {1}')
# sadly we can't use "$@" here directly because we are inside sh -c "..." call
# already
st -c fzfmenu -n fzfmenu -e sh -c "cat $input | fzf $(printf -- " '%s'" "$@") | tee $output" & disown
# handle ctrl+c outside child terminal window
trap "kill $! 2>/dev/null; rm -f $input $output" EXIT
@@ -1477,6 +1481,8 @@ cat > $input
cat $output
```
All arguments are passed to fzf.
Don't forget to add a float/center rule for `fzfmenu` class/name to your wm's config.
### dotfiles management