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

Grepper{Ack,Pt,Rg} are async in Neovim, but not Vim #65

Closed
habamax opened this issue Sep 26, 2016 · 18 comments
Closed

Grepper{Ack,Pt,Rg} are async in Neovim, but not Vim #65

habamax opened this issue Sep 26, 2016 · 18 comments
Labels

Comments

@habamax
Copy link

habamax commented Sep 26, 2016

vim8 and windows 10

pt is installed.

Trying to

:GrepperPt something<CR>

returns nothing although there is 'something' in the file.

Next thing is:

:GrepperPt<CR>

Error detected while processing function <SNR>77_on_exit:
line 10
E108: No such variable: "s:id"
@mhinz
Copy link
Owner

mhinz commented Sep 26, 2016

Unfortunately I can't test for Windows.

Is pt --nogroup something working manually?

(As for the second problem, it's most probably a follow-up issue. I'll add a fix for it anyway.)

@habamax
Copy link
Author

habamax commented Sep 26, 2016

yep

pt --nogroup something

gives a lot of results in a console

@mhinz
Copy link
Owner

mhinz commented Sep 26, 2016

Could you paste the output? I wonder if it's a different format than the expected one. It should look like this:

file1:12: there is something
file2:99: something rocks

@habamax
Copy link
Author

habamax commented Sep 26, 2016

tables.html:412:<td style="text-align: left;">12 (something to do with Clinton and maybe the '60's)</td>
tables.md:188:            (here's            (due to           (something to do
tables.tex:403:12 (something to do with Clinton and maybe the '60's)\strut

grepper

@habamax
Copy link
Author

habamax commented Sep 26, 2016

If I issue

 GrepperPt asdlfkjsdlfkjsldkfjal

I get a message: "No matches found"

Otherwise silence and no results (but they should be)

@habamax
Copy link
Author

habamax commented Sep 26, 2016

GrepperGrep, GrepperFindstr, GrepperGit works, btw

@mhinz
Copy link
Owner

mhinz commented Sep 26, 2016

Hmm, apparently Vim's async interface changed a bit. I can reproduce it on OSX as well now.

I'm looking into it.

@habamax
Copy link
Author

habamax commented Sep 26, 2016

Ok, thx a lot.

@mhinz
Copy link
Owner

mhinz commented Sep 27, 2016

Short update:

I'm pretty sure it's a Vim bug by now. Some jobs simply never give output. E.g. :GrepperGrep, :GrepperGit, :GrepperAg work, but :GrepperAck and :GrepperRg don't.

Here a minimal test case: https://gist.github.com/mhinz/a5d126e6c702a6ffd0347aa70c9ccb39
(You can open that file and do :so %. ag will give output, rg won't.)

@mhinz
Copy link
Owner

mhinz commented Sep 27, 2016

@chrisbra Sorry for disturbing you, but could you have a look at the minimal test case in the above post? I read vim_dev a bit, but I'm still not sure if that bug is already reported. Thanks in advance!

(If you don't have rg installed, you can use ack --noheading --column foo for cmd2 as well.)

@mhinz mhinz added the vim-bug label Sep 27, 2016
@mhinz mhinz changed the title GrepperPt on windows GrepperPt and GrepperAck work in Neovim, but not Vim Sep 27, 2016
@mhinz mhinz changed the title GrepperPt and GrepperAck work in Neovim, but not Vim Grepper{Ack,Pt,Rg} work in Neovim, but not Vim Sep 27, 2016
mhinz added a commit that referenced this issue Sep 27, 2016
We force a synchronous search for these tools, due to a Vim bug. For follow-up
posts see:

    #65 (comment)
mhinz added a commit that referenced this issue Sep 27, 2016
We force a synchronous search for these tools, due to a Vim bug. For follow-up
posts see:

    #65 (comment)

References #65.
@chrisbra
Copy link

Not sure, if this has already been mentioned, there are a couple of bugs mentioned in the todo list and in the issue tracker like vim/vim#1026
I'll look into it.

@chrisbra
Copy link

Hm, it looks like ack is still running and waiting for something...

@mhinz
Copy link
Owner

mhinz commented Sep 27, 2016

Yup, it never returns and the stdout handler is not called even once. I have no idea how async in Vim really works, so I'm rather puzzled by this. :\

But it happens for a few programs (ack, pt, ripgrep at least), so.. what do they do differently?

@mengelbrecht
Copy link

mengelbrecht commented Sep 27, 2016

For me rg works in async mode (macOS 10.12 + Vim8) if I use
'grepprg': 'rg --no-heading --line-number --column $* .'

The . for the current directory is essential. Otherwise it does not work and it seems rg is waiting for data from stdin.

@mhinz
Copy link
Owner

mhinz commented Sep 27, 2016

@mgee Hmm, I see.. BurntSushi/ripgrep#19

@mhinz
Copy link
Owner

mhinz commented Sep 28, 2016

So, when both, Neovim's jobstart() and Vim's job_start(), use pipes by default, where's the difference?

There must be some smart code in libuv (which is used by Neovim) that isn't part of Vim's custom solution.

@chrisbra
Copy link

sounds like it. I wonder if there is something, that should be done by Vim.

@mhinz mhinz changed the title Grepper{Ack,Pt,Rg} work in Neovim, but not Vim Grepper{Ack,Pt,Rg} are async in Neovim, but not Vim Oct 5, 2016
@mhinz mhinz closed this as completed in 43b71de Nov 11, 2016
@mhinz
Copy link
Owner

mhinz commented Nov 11, 2016

Actually closed by: #77

wincent added a commit to wincent/ferret that referenced this issue Jan 8, 2017
For some reason, `ag` worked fine in async mode, but `rg` hangs forever
unless you disconnect stdin.

Found via Google:

- mhinz/vim-grepper#65
- mhinz/vim-grepper#77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants