Skip to content

Commit

Permalink
[Search Directory][Search Variables] sunset deprecated fzf opts varia…
Browse files Browse the repository at this point in the history
…bles
  • Loading branch information
PatrickF1 committed Nov 5, 2023
1 parent 82dd51e commit 615ce65
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ fzf supports global default options via the [FZF_DEFAULT_OPTS](https://github.co

### Pass fzf options for a specific command

The following variables can store custom options that will be passed to fzf by their respective command:
The following variables configure the fzf options for their respective command:

| Command | Variable |
| ----------------- | --------------------- |
Expand Down
7 changes: 7 additions & 0 deletions conf.d/fzf.fish
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ function _fzf_uninstall --on-event fzf_uninstall
echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings."
set_color normal
end

function _fzf_migration_message --on-event fzf_update
set_color FF8C00 # dark orange
printf '\n%s\n' '[fzf.fish] Breaking change: if you have $fzf_dir_opts or $fzf_shell_vars_opts set in your environment, rename them to $fzf_directory_opts and $fzf_variables_opts respectively.'
printf '%s\n\n' 'See https://github.com/PatrickF1/fzf.fish/wiki/Migration-Guides#v10.1.'
set_color normal
end
3 changes: 1 addition & 2 deletions functions/_fzf_search_directory.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ function _fzf_search_directory --description "Search the current directory. Repl
set -f fd_cmd (command -v fdfind || command -v fd || echo "fd")
set -f --append fd_cmd --color=always $fzf_fd_opts

# $fzf_dir_opts is the deprecated version of $fzf_directory_opts
set -f fzf_arguments --multi --ansi $fzf_dir_opts $fzf_directory_opts
set -f fzf_arguments --multi --ansi $fzf_directory_opts
set -f token (commandline --current-token)
# expand any variables or leading tilde (~) in the token
set -f expanded_token (eval echo -- $token)
Expand Down
3 changes: 1 addition & 2 deletions functions/_fzf_search_variables.fish
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ function _fzf_search_variables --argument-names set_show_output set_names_output
--preview-window="wrap" \
--multi \
--query=$cleaned_curr_token \
# $fzf_shell_vars_opts is the deprecated version of $fzf_variables_opts
$fzf_shell_vars_opts $fzf_variables_opts
$fzf_variables_opts
)

if test $status -eq 0
Expand Down
2 changes: 1 addition & 1 deletion tests/search_directory/expands_var_in_query.fish
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set target "file 1.txt"

set --global fzf_dir_opts --select-1
set --global fzf_directory_opts --select-1
mock commandline --current-token "echo \$target"
mock commandline "--current-token --replace --" "echo \$argv"
mock commandline \* ""
Expand Down

0 comments on commit 615ce65

Please sign in to comment.