Skip to content
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

Run FZF cancel callback based on v:event #10

Closed
gbrlsnchs opened this issue Dec 23, 2021 · 1 comment · Fixed by #102
Closed

Run FZF cancel callback based on v:event #10

gbrlsnchs opened this issue Dec 23, 2021 · 1 comment · Fixed by #102

Comments

@gbrlsnchs
Copy link

Inspired by this plugin, I'm experimenting with fzf#run myself, and its terminal command returns 1 if there's an error with the command or 130 if nothing is chosen (I tested pressing both Esc and Ctrl+C).

Therefore, you can check v:event to capture the fzf command exit status and only run the cancel callback when the status is not 0 (or only when it's 130 depending on how you want to handle errors). You can do that in a TermClose autocmd, instead of deferring a callback using BufLeave.

@stevearc
Copy link
Owner

Yeah, I do like that better than the deferred function. Thanks for the tip!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants