Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for FZF_DEFAULT_OPTS_FILE #319

Merged
merged 4 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ Call `fzf_configure_bindings` in your `config.fish` in order to persist your cus

### Change fzf options for all commands

fzf supports global default options via the [FZF_DEFAULT_OPTS](https://github.com/junegunn/fzf#environment-variables) environment variable.
fzf supports global default options via the [FZF_DEFAULT_OPTS or FZF_DEFAULT_OPTS_FILE](https://github.com/junegunn/fzf#environment-variables) environment variables.

`fzf.fish` sets [a sane `FZF_DEFAULT_OPTS` whenever it executes fzf](functions/_fzf_wrapper.fish). If you export your own `FZF_DEFAULT_OPTS`, then yours will be used instead.
`fzf.fish` sets [a sane `FZF_DEFAULT_OPTS` whenever it executes fzf](functions/_fzf_wrapper.fish) unless you export your own `FZF_DEFAULT_OPTS` or `FZF_DEFAULT_OPTS_FILE`.

### Change fzf options for a specific command

Expand Down
4 changes: 2 additions & 2 deletions functions/_fzf_wrapper.fish
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ function _fzf_wrapper --description "Prepares some environment variables before
# Use --function so that it doesn't clobber SHELL outside this function.
set -f --export SHELL (command --search fish)

# If FZF_DEFAULT_OPTS is not set, then set some sane defaults.
# If FZF_DEFAULT_OPTS or FZF_DEFAULT_OPTS_FILE is not set, then set some sane defaults.
# See https://github.com/junegunn/fzf#environment-variables
if not set --query FZF_DEFAULT_OPTS
if not set --query FZF_DEFAULT_OPTS || not set --query FZF_DEFAULT_OPTS_FILE
Copy link
Owner

@PatrickF1 PatrickF1 Apr 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I think this is wrong. We will enter this branch if either FZF_DEFAULT_OPTS or FZF_DEFAULT_OPTS_FILE are not set, even if the other one IS set. It only skips the branch if both are set. I'll fix it. This is probably why the Linux tests are failing.

# cycle allows jumping between the first and last results, making scrolling faster
# layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env
# border shows where the fzf window begins and ends
Expand Down
Loading