Skip to content

[Suggestion] A suggested footnote for FZF_DEFAULT_OPTS #4836

Description

@GrassGlass

Checklist

  • I have read through the manual page (man fzf)
  • I have searched through the existing issues
  • For bug reports, I have checked if the bug is reproducible in the latest version of fzf

Output of fzf --version

0.73.1 (Fedora)

OS

  • Linux
  • macOS
  • Windows
  • Etc.

Shell

  • bash
  • zsh
  • fish

Problem / Steps to reproduce

Current Behavior

With both

$ fzf --prompt=';'

and

$ FZF_DEFAULT_OPTS='--prompt=";"' fzf

we get the expected output, that the prompt is a semicolon:

Image

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:

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions