github PatrickF1/fzf.fish v6.0

latest releases: v10.3, v10.2, v10.1...
3 years ago

Allow passing custom fzf options to individual commands (#140)

By popular demand, everyone can now easily customize fzf to their hearts content!

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

  • fzf_dir_opts => search directory
  • fzf_git_status_opts => search git status
  • fzf_git_log_opts => search git log
  • fzf_history_opts => search history
  • fzf_shell_vars_opts => search shell variables

They are always appended last to fzf's argument list so that they can override any hardcoded fzf options. This might lead to some people shooting themselves in the foot but also unlocks numerous opportunities for the user to customize or augment the existing features.

Some of the cool ideas now made possible include:

[Search directory] expand variables in current token (#133)

Sidenote: The search directory feature was previously called search files but I've since changed the name.
Now, the search directory feature will not only expand tilde (~) in the current token, it will expand variables as well. This is useful for quickly accessing known directory variables, e.g. $XDG_CONFIG_HOME, $TMPDIR, $JAVA_HOME, $fisher_path, $__fish_user_data_dir.

Bug fixes

  • Support fish_hybrid_key_bindings (#136 - @sandersantema )
  • [Search directory] fix two bugs around preview for paths containing spaces (#137 - @kidonng and me)
  • [Search directory] More accurate and helpful error when a previewing a path that doesn't exist (#137)

In case you missed it: previous changes from v5 worth re-mentioning

More configurables

The focus of work from v5 to v6 was on making fzf.fish much more configurable. fd can receive custom options by setting fzf_fd_opts (#126):

set -g fzf_fd_opts --hidden --exclude=.git

which makes it easy to configure things such as if you want to see hidden files or only show non-directory files.
Additionally, the command used to preview folders in the search directory feature can be changed by setting fzf_preview_dir_cmd (#120):

set -g fzf_preview_dir_cmd exa --all --color=always

which allows integration with popular ls replacements such as exa, lsd, colorsls, etc.

Preview entire command in command in history search with syntax highlighting (#125, #134, #135)

Screen Shot 2021-03-23 at 9 44 17 AM

[Search directory] Ability to specify which directory to search (#75)

  • This new behavior allows the user to choose to search a directory other than the current directory. If the current token is a directory and it has a trailing slash (e.g. vim functions/<CURSOR>), then we assume the user wants to search for files in that directory.
  • This can be useful when the current directory contains large subdirectories (e.g. on macOS, the home directory contains ~/Library, which is very large). Moreover, it also allows searching a parent or sibling directory by using ../ (e.g. ../Downloads/<CURSOR>).
  • What's great is that this behavior complements tab completion. When a user wants to access a file in a subdirectory, they may start typing the name of the directory and hit TAB. When tab completion writes out the directory's path, it will already append a trailing slash for the user, allowing the user to quickly execute the search files feature and search for the file in a more narrow scope.
  • Variables within the current token, e.g. $XDG_CONFIG_HOME, will be expanded (#133).

Don't miss a new fzf.fish release

NewReleases is sending notifications on new releases.