-
Notifications
You must be signed in to change notification settings - Fork 103
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 use-fzf-default-opts
#479
Changes from 1 commit
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 |
---|---|---|
|
@@ -40,6 +40,7 @@ local ret=0 | |
-ftb-zstyle -a switch-group switch_group || switch_group=(F1 F2) | ||
-ftb-zstyle -s fzf-pad fzf_pad || fzf_pad=2 | ||
-ftb-zstyle -s fzf-min-height fzf_min_height || fzf_min_height=0 | ||
-ftb-zstyle -b use-fzf-default-opts use_fzf_default_opts || use_fzf_default_opts="no" | ||
|
||
-ftb-zstyle -a debug-command debug_command && { | ||
${(eX)debug_command} $fzf_flags | ||
|
@@ -81,7 +82,12 @@ fi | |
|
||
_ftb_query="${_ftb_query}$(command "$dd" bs=1G count=1 status=none iflag=nonblock < /dev/tty 2>/dev/null)" || true | ||
|
||
FZF_DEFAULT_OPTS='' SHELL=$ZSH_NAME $fzf_command \ | ||
local fzf_default_opts='' | ||
if [[ "$use_fzf_default_opts" == "yes" ]]; then | ||
fzf_default_opts=$FZF_DEFAULT_OPTS | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering if I that case you could get ride off the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I was going for a quick change so didn't try that. I thought Let me try that and get back here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I remember it now. Since And # this converts the string to a string array which is expected by fzf-flags.
export parsed_fzf_default_opts=(${=FZF_DEFAULT_OPTS})
zstyle ':fzf-tab:*' fzf-flags $parsed_fzf_default_opts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your suggestion doesn't seem to be working for my case:
I think the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pablospe can you try this? zstyle ':fzf-tab:*' fzf-flags ${(Q)${(Z:nC:)FZF_DEFAULT_OPTS}} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is magic! It is working, thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are my flags,
While |
||
fi | ||
|
||
FZF_DEFAULT_OPTS=$fzf_default_opts SHELL=$ZSH_NAME $fzf_command \ | ||
--ansi \ | ||
--bind=$binds \ | ||
--bind="${switch_group[1]}:reload($reload_command -1),${switch_group[2]}:reload($reload_command 1)" \ | ||
|
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.
I think we should warn user that this may cause unexpected behavior.
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.
@PrayagS I think you can mention here there are other plugins that overrides the value of fzf-flags directly, creating bugs.
Now I was wondering if overriding the fzf-flags is the right thing to do for an external plugin, it should do something like:
fzf-flags = fzf-flags + <extra_things>
?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.
@Aloxaf Updated the README. Please review
380daee
(#479).@pablospe My comment on Freed-Wu/fzf-tab-source causing a conflict is a hunch. Because when I was reviewing its code, it overrides it specifically for a completion type (see https://github.com/Freed-Wu/fzf-tab-source/blob/aabde06d1e82b839a350a8a1f5f5df3d069748fc/fzf-tab-source.plugin.zsh#L31). The more likely reason for it to not work could be just a parsing issue with the flags.