Giter Club home page Giter Club logo

Comments (4)

junegunn avatar junegunn commented on September 27, 2024 1

it's quite a breaking change

Yeah, but I'd say it was a misuse of a feature, like the spacebar heating case.

from fzf.

junegunn avatar junegunn commented on September 27, 2024

Yes, it is intentional. execute action is for executing an external program in the alternate screen without leaving fzf, and it isn't supposed to affect the final output of fzf.

fzf/CHANGELOG.md

Lines 71 to 75 in 6de0a7d

- Process started by `execute` action now directly writes to and reads from `/dev/tty`. Manual `/dev/tty` redirection for interactive programs is no longer required.
```sh
# Vim will work fine without /dev/tty redirection
ls | fzf --bind 'space:execute:vim {}' > selected
```

For example, when you run selected=$(ls | fzf --bind 'ctrl-o:execute:vim {}'), you don't want any output from Vim in the final output of fzf. Also, prior to 0.53.0, you would have to redirect the standard output of Vim to /dev/tty for it to work properly in this case. Considering the original purpose of execute, this was confusing and not ergonomic.

Another mistake here is using execute where you should be using execute-silent. execute runs the command in the alternate screen, you'll notice screen flashing.

fzf --bind 'space:execute-silent(ls)+accept' --height 30%

how can I now replicate the prior-0.53.0 behaviour?

1. Use print action

fzf --bind 'f1:print(f1)+accept' fzf --bind 'f2:print(f2)+abort'

2. Use become action

fzf --bind 'f1:become:echo f1; echo {}' --bind 'f2:become:echo f2; exit 1'

3. Use --expect

If you just need the key names to be printed, --expect is the simplest.

fzf --expect f1,f2

from fzf.

097115 avatar 097115 commented on September 27, 2024

So, for the reference, it's

--bind 'f2:print(ccc)+accept'

instead of

--bind='f2:execute(printf ccc)+accept'

to get ccc aaa from the example above. And (with optional exit 1 if needed)

--bind 'f1:become:echo bbb' 

instead of

--bind='f1:execute(printf bbb)+abort'

to get bbb.

While certainly looking more logical and more consistent, it's quite a breaking change, I'd say...

from fzf.

097115 avatar 097115 commented on September 27, 2024

Forgot to say thanks for the explanation :)

from fzf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.