Giter Site home page Giter Site logo

Comments (7)

tjdevries avatar tjdevries commented on August 13, 2024

isn't fzf waiting for something to input to it so that it can output something?

You can try piping something into the job if you want perhaps. Or connect one job to another. I think I had an idea about do unix style "piping" between jobs. I can investigate that.

from plenary.nvim.

tjdevries avatar tjdevries commented on August 13, 2024

fixed w/ new writer parameter

from plenary.nvim.

cseickel avatar cseickel commented on August 13, 2024

I think there was a misunderstanding here, can we re-open this?

The example command was run with the --filter option, which is meant for scripting and does not start an interactive process. WIth that option, it behaves more like fd but using the fuzzy algorithm. If you run it in a terminal, it outputs newline separated relative file paths for the matches and exits.

@smolck did you find a solution to this issue?

from plenary.nvim.

Conni2461 avatar Conni2461 commented on August 13, 2024

no it cant be reopened. the example was missing the pipe and that features was added with the writer interface

local Job = require("plenary.job")

Job:new({
  command = "fzf",
  args = {"--no-sort", "--filter", "thing"},
  on_stdout = function(_, data, _)
    print(data)
  end,
  on_exit = function(_, code, _)
    print("exit", code)
  end,
  writer = Job:new{
    command = "fd",
  },
}):start()

from plenary.nvim.

cseickel avatar cseickel commented on August 13, 2024

Thanks for the quick response @Conni2461 . I don't get it though, why would you pipe the fd command into fzf? The fzf --filter thing command is the complete command I am trying to run, and it exits immediately without input when run from a terminal. I don't need to add the fd command.

I'm trying to investigate, it seems like fzf is doing something with stdout/stderr that is unexpected. It works fine at the command line but never calls those methods when run in the job.

EDIT: Also, the above example produces errors when I try to run it:

Error executing vim.schedule lua callback: .../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:217: bad argument #1 to 'is_active' (Expected uv_hand
le userdata)
stack traceback:
        [C]: in function 'is_active'
        .../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:217: in function 'shutdown'
        .../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:343: in function <.../site/pack/packer/start/plenary.nvim/lua/plenary/job.lua:342>
Error executing luv callback:
cannot resume dead coroutine
stack traceback:
        [builtin#36]: at 0x58f462326ad0

from plenary.nvim.

rohit-kumar-j avatar rohit-kumar-j commented on August 13, 2024

@cseickel, were you able to use this solve this with the writer option?

from plenary.nvim.

rohit-kumar-j avatar rohit-kumar-j commented on August 13, 2024

@Conni2461, is there a way to do something like:

writer = Job:new{
    command = "stdin", -- for an interactive experience.. like a prompt-buffer?
  },

from plenary.nvim.

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.