-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
CTRL-R: How to toggle between global and per-directory history within fzf? #3539
Comments
fzf runs an external command with a new child shell process ( |
Hot dog, your change seems to resolve the error! But now I get a different one:
My zsh-fu isn't good enough to debug this, it seems. I tried to invoke
I did this
The hope was that making making the wrapper function the widget and keeping the original function not a widget would allow fzf to call it directly. But I still got exactly the same error!
Any thoughts or advice? |
man fzf
)Info
Sorry to blow up your issues lately. I love how deep you can take things with
fzf
if suitably motivated!Inquiry
I use the wonderful
per-directory-history
plugin in Zsh. Using it,^G
will toggle between history files, either global or PWD-specific.Without any modification of
fzf
, theCTRL-R
output shows the correct history depending on the mode (i.e., global vs. PWD-specific). However, if I want to switch modes, I have to exitfzf
, toggle the mode with^G
, then re-enterfzf
. I'm wondering if it's possible to do this all withinfzf
.I attempted to achieve this with various flavors of
--bind='ctrl-g:execute(per-directory-history-toggle-history)'
(NB: that function comes from the plugin [source]), but I get an error thatper-directory-history-toggle-history
cannot be found. Am I on the right track?Followup inquiry
Lastly, to add one more layer of complexity that's specific to me, I wrap
fzf-history-widget
with my own simple logic to add a little indicator of the current history mode to thefzf
prompt. I then bind this function to^R
, overwritingfzf
's binding. The code shown below displays the correct indicator as intended:This is where I tried to add the
--bind
bit, in hopes that^G
withinfzf
would not only toggle the mode and refresh the results, but also update the indicator:But when I add in
--bind='...'
, openfzf
with^R
, and hit^G
, it fails:I'm quite confident that this should be possible, but I can't quite figure it out. Any assistance @junegunn?
The text was updated successfully, but these errors were encountered: