-
Notifications
You must be signed in to change notification settings - Fork 688
feat: support fzf extra options #1026
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
efac858
0fac619
8360bd3
8fc4b2b
7936aa6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,29 +91,29 @@ impl Query { | |
|
|
||
| fn get_fzf() -> Result<FzfChild> { | ||
| let mut fzf = Fzf::new()?; | ||
| if let Some(fzf_opts) = config::fzf_opts() { | ||
| if let Some(mut fzf_opts) = config::fzf_opts() { | ||
| if let Some(fzf_extra_opts) = config::fzf_extra_opts() { | ||
|
||
| fzf_opts.push(" "); | ||
| fzf_opts.push(fzf_extra_opts); | ||
| } | ||
|
|
||
| fzf.env("FZF_DEFAULT_OPTS", fzf_opts) | ||
| } else { | ||
| fzf.args([ | ||
| // Search mode | ||
| "--exact", | ||
| // Search result | ||
| "--no-sort", | ||
| // Interface | ||
| "--bind=ctrl-z:ignore,btab:up,tab:down", | ||
| "--cycle", | ||
| "--keep-right", | ||
| // Layout | ||
| "--border=sharp", // rounded edges don't display correctly on some terminals | ||
| "--height=45%", | ||
| "--info=inline", | ||
| "--layout=reverse", | ||
| // Display | ||
| "--tabstop=1", | ||
| // Scripting | ||
| "--exit-0", | ||
| ]) | ||
| .enable_preview() | ||
| let default_args = config::fzf_default_args(); | ||
| let args = if let Some(fzf_extra_opts) = config::fzf_extra_opts() { | ||
|
||
| let extra_fzf_args_list: Vec<String> = fzf_extra_opts | ||
| .to_str() | ||
| .unwrap_or_default() | ||
| .split_whitespace() | ||
| .map(|arg| String::from(arg)) | ||
| .collect(); | ||
|
|
||
| vec![default_args, extra_fzf_args_list].concat() | ||
| } else { | ||
| default_args | ||
| }; | ||
|
|
||
| fzf.args(args).enable_preview() | ||
| } | ||
| .spawn() | ||
| } | ||
|
|
||
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.
This could be a match expression
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.
That's right, updated.