babarot/enhancd

Correct way to provide additional options to fzf

tinng81 opened this issue · 5 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" '

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

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

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

Looks working fine

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).