rking / ag.vim

Vim plugin for the_silver_searcher, 'ag', a replacement for the Perl module / CLI script 'ack'
1.74k stars 131 forks source link

Feature request: Asynchronous NeoVim support #85

Open xanderdunn opened 9 years ago

xanderdunn commented 9 years ago

This would be a great plugin to make asynchronous because searches often take considerable time where I could be looking through my code instead of staring at ag std output.

NeoVim users could immediately benefit if ag.vim were to support NeoVim's new asynchronous plugin architecture.

losingkeys commented 9 years ago

This sounds like a good idea. Can you link me to some docs where I can read about how to add neovim support to this plugin? It might be a good idea for me (or whoever implements this) to add vim-dispatch support as well, for people who use that.

xanderdunn commented 9 years ago

Thanks for your interest!

Start with NeoVim's wiki article on plugin architecture. It links to NeoVim's remote plugin help page, which is probably the single best source of documentation on making a NeoVim remote (asynchronous) plugin.

You might also look at the changes made to YouCompleteMe to support the NeoVim plugin architecture.

Finally, I think another good example of a NeoVim plugin is the Floobits plugin, which is a plugin built intentionally for NeoVim's plugin architecture, not supporting legacy vim plugin architecture.

I'm also trying to learn how to NeoVim-ify plugins so that I can help make a lot of plugins asynchronous.

ghost commented 9 years ago

There's also this: https://github.com/junegunn/vim-plug/pull/103

xanderdunn commented 9 years ago

@Pyrohh Ohh, that's great! Thanks! The more examples to learn from, the better!

vhakulinen commented 9 years ago

Any work being done with this?

losingkeys commented 9 years ago

None by me yet. I need to set up neovim and get started. Hopefully in the next couple of weeks, but I can't be sure. PRs welcome :)

vhakulinen commented 9 years ago

Wish I had time to stuff like this.. =/

ches commented 9 years ago

FYI, Dispatch support was added to ack.vim pretty easily: mileszs/ack.vim#126.

losingkeys commented 9 years ago

Hmm, I wonder if we should do something like that, and maybe have option(s) to say "use other plugins" if they're available. That way maybe it uses Dispatch by default, but you can still turn it off (to get the previous behavior, where it's not opening up other terminals/tmux splits/whatever).

I installed neovim, but had some issues with it's python usage. I think it's one of those things where they put python instead of python2 in the #! and arch users have trouble. I'll need to fix my install before starting work on this one.

ches commented 9 years ago

I actually started hacking on Dispatch support, and it's more of a can of worms than it looked. The implementation on ack.vim wasn't very good/thorough/documented, needed some follow-up fixes, and has other extant bugs and shortcomings that I'm realizing as I've tried adding it to ag.vim.

It's not that difficult, per se, it just ends up not being a very natural fit. For instance:

I got far enough already that I'll probably open a pull request anyway once I finish and re-share these observations for discussion, but because of these and because ag is so friggin' fast already, I decided to set it aside to work on another feature I'm more interested in.

Of course this is just Dispatch. Onward and upward with discussion of NeoVim :smile:

xanderdunn commented 9 years ago

@losingkeys Since NeoVim has shed internal support for other languages, have you installed the python package for NeoVim support: pip install neovim? Just making sure.

losingkeys commented 9 years ago

@alexdunn I didn't read the install instructions, just thought I'd install the editor and it'd work. I'll give that a shot, thanks!

losingkeys commented 9 years ago

Here's a screenshot of what I see when I open a file (opening the editor seems to work):

2015-02-10-192054_995x720_scrot

I'm thinking it's a python 2/3 issue. Do you know an obvious fix? Otherwise I'll poke around a bit myself.

vhakulinen commented 9 years ago

Had the same problem. Install python2 version of the neovim stuff.

losingkeys commented 9 years ago

Odd. I used the aur script to install it. I'll give that a shot though. Thanks.

mtglsk commented 9 years ago

Any progress on this feature?

losingkeys commented 9 years ago

None from me, other than I found out I had both the python 2 and 3 versions of neovim installed. Not sure if I did that or the AUR script did. Either way you'd think it wouldn't be in the 3 repos if it doesn't work. Anyway it'd be nice to get dispatch/neovim support in the same pull, but like I said I haven't made any progress yet :smile:

ViViDboarder commented 9 years ago

Found a grep plugin that uses nvim's job control and dispatch.

Here's the nvim part: https://github.com/bruno-/vim-man/blob/master/autoload/man/grep/nvim.vim

nomasprime commented 9 years ago

This would be :spades:

Numkil commented 9 years ago

I have made async support for ag.vim in my fork. Some feedback would be nice. It works atm only for :Ag and :LAg. It also supports my current running pull request for searching from root of project if you choose this. https://github.com/Numkil/ag.nvim I'm still working on it.

nomasprime commented 9 years ago

Thanks @Numkil, will check it out.

Numkil commented 9 years ago

:+1: You are welcome, It is a very fun learning experience. A small remark though, running ag in your /home/ searching for a common word (Something that generates thousands of hits) will still crash vim, due to the way how I have to capture and save the output from the shell job(list operations are expensive in viml). Running long jobs is not a problem as long have you have a reasonable amount of hits.

ViViDboarder commented 9 years ago

FYI: mhinz/vim-grepper by @mhinz does async ag calls using Dispatch and Neovim. His implementation is a bit different though and it doesn't really function as an ag.vim replacement.