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

fzf using --no-clear and execute #2028

Closed
5 of 10 tasks
bigH opened this issue May 10, 2020 · 2 comments
Closed
5 of 10 tasks

fzf using --no-clear and execute #2028

bigH opened this issue May 10, 2020 · 2 comments

Comments

@bigH
Copy link

bigH commented May 10, 2020

  • I have read through the manual page (man fzf)
  • I have the latest version of fzf
  • I have searched through the existing issues

Info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Etc.
  • Shell
    • bash
    • zsh (iTerm & Alacritty)
    • fish

Problem / Steps to reproduce

Run this command (tried execute-silent also):

fzf --no-clear --bind 'enter:execute(fzf)'

When pressing Enter, I expect the fzf -> fzf transition to be seamless, instead I see a blinking of my terminal.

It seems that --no-clear is great if you exit fzf and re-run it. In this case, building "stacking" fzf's is not possible.

@polijan
Copy link

polijan commented Jun 18, 2020

Hi, I found this trick to invoke fzf from within --bind with no flickering:

  1. use execute-silent to prevent any screen switching
  2. redirect stderr to /dev/tty so that your "internal" fzf displays ok
  3. use clear-screen after your command to repaint the "initial" fzf finder

Everything then displays on alternate screen with no screen flashing.
Here's one example (press F1):
find . -type f | fzf --bind 'f1:execute-silent(cat {} | fzf 2>/dev/tty)+clear-screen'

Best Regards,
Florian

@junegunn
Copy link
Owner

execute by design runs the command in the alternate screen which is not affected by --no-clear. I would recommend that you implement the "stacking" using shell script outside of fzf, rather than circumventing the limitations of execute bindings.

But the solution @notevenodd posted is quite clever.

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

No branches or pull requests

3 participants