-
Notifications
You must be signed in to change notification settings - Fork 88
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
Allow passing custom fzf opts to individual commands #140
Conversation
ed5b4fe
to
8fbdc23
Compare
1e55e6f
to
2a2acca
Compare
@@ -16,10 +16,10 @@ function __fzf_search_current_dir --description "Search the current directory. R | |||
if string match --quiet -- "*/" $token && test -d "$unescaped_exp_token" | |||
set --append fd_opts --base-directory=$unescaped_exp_token | |||
# use the directory name as fzf's prompt to indicate the search is limited to that directory | |||
set --append fzf_arguments --prompt="$unescaped_exp_token" --preview="__fzf_preview_file $expanded_token{}" | |||
set --prepend fzf_arguments --prompt="$unescaped_exp_token" --preview="__fzf_preview_file $expanded_token{}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prepend so that $fzf_dir_opts always appears last
|
||
### Change the command used to preview folders | ||
|
||
The search files feature, by default, uses `ls` to preview the contents of a directory. To integrate with the variety of `ls` replacements available, the command used to preview directories is configurable through the `fzf_preview_dir_cmd` variable. For example, in your `config.fish`, you may put: | ||
The search directory feature, by default, uses `ls` to preview the contents of a directory. To integrate with the variety of `ls` replacements available, the command used to preview directories is configurable through the `fzf_preview_dir_cmd` variable. For example, in your `config.fish`, you may put: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally settling on the name search directory to make room for search files by pattern (#118) in the features namespace
@@ -11,9 +11,11 @@ function __fzf_search_git_log --description "Search the output of git log and pr | |||
# see documentation for git format placeholders at https://git-scm.com/docs/git-log#Documentation/git-log.txt-emnem | |||
# %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below | |||
git log --color=always --format=format:$log_fmt_str | \ | |||
fzf --ansi --tiebreak=index \ | |||
fzf --ansi \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
broke up options list into one option by line for readability
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 users shooting themselves in the foot but also unlocks numerous opportunities for the user to customize or augment the existing features. This was an oft requested feature that I parried for a long time but now I am very excited to finally add. With this, change, some of the cool ideas now made possible include: - add key bindings within fzf to operate on the selected line, e.g. open file in vim, preview file as image, copy to clipboard, git checkout commit, git reset commit - adjust the preview window or command - re-populate fzf's input list on demand - change the search mode - and many, many more
The following variables can store the custom fzf 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 fzf options that are hardcoded in by fzf.fish. This might lead to some users shooting themselves in the foot but also unlocks numerous opportunities for the user to customize or augment the existing features.
This was an oft requested feature that I parried for a long time but now I am very excited to finally add. With this, change, some of the cool ideas now made possible include