enhancd icon indicating copy to clipboard operation
enhancd copied to clipboard

Correct way to provide additional options to fzf

Open tinng81 opened this issue 4 years ago • 3 comments

Question What is the correct way to provide additional options to fzf?

Currently, directly modifying ENHANCD_FILTER works fine unless supplying --bind export ENHANCD_FILTER="fzf --preview 'tree -d -C {} | head -100'"

@ress997 in #150 (comment) did suggest to directly modify FZF_DEFAULT_OPTS but that's not what I'm aiming for since I'd rather modify for this specific use case.

I suspect this have to do with enhancd parsing but if you think the issue originated from fzf, do let me know. FYI, the bindings worked for standalone fzf.

Considerations

Supplying --bind will result in parsing error even though the quotes were correctly typed

export ENHANCD_FILTER="fzf --preview 'tree -d -C {} | head -100' --bind 'alt-down:preview-page-down' "

❯ cd --
(eval):1: unmatched '
__enhancd::cd:shift:70: shift count must be <= $#

Neither swap position doesn't work

export ENHANCD_FILTER="fzf --bind '?:toggle-preview' --preview 'tree -d -C {} | head -100' "

Nor swap the quotes altogether

export ENHANCD_FILTER='fzf --preview "tree -d -C {} | head -100" --bind "alt-down:preview-page-down" '

tinng81 avatar Apr 04 '21 13:04 tinng81

Are you only using enhancd for working with fzf in Fish or do you have another use case?

jorgebucaran avatar Apr 04 '21 13:04 jorgebucaran

I'm actually using enhancd for working with fzf in Zsh

tinng81 avatar Apr 04 '21 13:04 tinng81

For me even something simple like ENHANCD_FILTER="fzf --preview 'ls {}'" doesn't work. I get unknown option {}

mustaqimM avatar Apr 02 '22 06:04 mustaqimM

Looks working fine

babarot avatar Mar 25 '23 17:03 babarot

Also, you cannot add the words including ":" to ENHANCD_FILTER such as alt-down:preview-page-down unfortunetly because ":" is used for spliting ENHANCD_FILTER (please read README).

babarot avatar Mar 25 '23 17:03 babarot