Checklist
Output of fzf --version
0.73.1 (Fedora)
OS
Shell
Problem / Steps to reproduce
Current Behavior
With both
and
$ FZF_DEFAULT_OPTS='--prompt=";"' fzf
we get the expected output, that the prompt is a semicolon:
However,
$ FZF_DEFAULT_OPTS='--prompt=;' fzf # Edited for typo
results in what I deduce is shell interpretation of the semicolon, resulting in an empty prompt:
Expected Behavior
(What a user might initially/naively expect)
$ FZF_DEFAULT_OPTS='--prompt=;' fzf
should produce the same output as fzf --prompt=';' and FZF_DEFAULT_OPTS='--prompt=;' fzf.
Suggestion
I believe I understand why shell interpretation is used: if we execute something like
fzf "$FZF_DEFAULT_OPTS $@"
the shell will just treat $FZF_DEFAULT_OPTS" as one massive argument to fzf. So, something like
bash -c "fzf $FZF_DEFAULT_OPTS $@"
is necessary.
But it might not be obvious to the average user why their FZF_DEFAULT_OPTS string is not working. I was very confused for a while just now, and almost even filed this as bug report haha, when trying to include a custom prompt ($'--prompt="\033[30;44m\033[0m\033[34m\033[0m "\n') in my FZF_DEFAULT_OPTS. I searched through man fzf, the official online docs, and fzf --bash to no avail.
Perhaps we could have a little note somewhere in the man page warning the user to escape their FZF_DEFAULT_OPTS approperiately. That way, if they are stumped like I was, a simple search /FZF_DEFAULT_OPTS in man fzf will bring this to their attention. This is a skill issue on my part for not realising this earlier, but I think clearer documentation benefits everyone.
Checklist
man fzf)Output of
fzf --version0.73.1 (Fedora)
OS
Shell
Problem / Steps to reproduce
Current Behavior
With both
$ fzf --prompt=';'and
$ FZF_DEFAULT_OPTS='--prompt=";"' fzfwe get the expected output, that the prompt is a semicolon:
However,
results in what I deduce is shell interpretation of the semicolon, resulting in an empty prompt:
Expected Behavior
(What a user might initially/naively expect)
$ FZF_DEFAULT_OPTS='--prompt=;' fzfshould produce the same output as
fzf --prompt=';'andFZF_DEFAULT_OPTS='--prompt=;' fzf.Suggestion
I believe I understand why shell interpretation is used: if we execute something like
fzf "$FZF_DEFAULT_OPTS $@"the shell will just treat
$FZF_DEFAULT_OPTS"as one massive argument tofzf. So, something likebash -c "fzf $FZF_DEFAULT_OPTS $@"is necessary.
But it might not be obvious to the average user why their
FZF_DEFAULT_OPTSstring is not working. I was very confused for a while just now, and almost even filed this as bug report haha, when trying to include a custom prompt ($'--prompt="\033[30;44m\033[0m\033[34m\033[0m "\n') in myFZF_DEFAULT_OPTS. I searched throughman fzf, the official online docs, andfzf --bashto no avail.Perhaps we could have a little note somewhere in the man page warning the user to escape their
FZF_DEFAULT_OPTSapproperiately. That way, if they are stumped like I was, a simple search/FZF_DEFAULT_OPTSinman fzfwill bring this to their attention. This is a skill issue on my part for not realising this earlier, but I think clearer documentation benefits everyone.