Monday, April 2, 2012

Re: Async to process some task in vim

On Sunday, April 1, 2012 2:18:29 PM UTC-5, Gary Johnson wrote:
> On 2012-03-31, 曾波 wrote:
> > dear all,
> >
> >       when i process creating tags, cscope, grep find in a large project, vim
> > will suspend since this task finish.
> >
> > it's very annoying!  do you have some good idea?
>
> You can easily generate tags and cscope data in the background with
> commands like these:
>
> :!ctags -R &
> :!cscope -R -b &
>
> The problem is knowing when they're done. For that, you could do
> something like this:
>
> :!{ ctags -R; xmessage 'ctags done'; } &
>
> Using grep is a little trickier because you usually want to read the
> results into a quickfix list. For that, you could do something like
> this:
>
> !{ grep -Rn pattern . > ~/mygrep.out; xmessage 'grep done'; } &
>
> followed by this when that is done:
>
> :let &efm=&gfm
> :cf ~/mygrep.out
>
> Regards,
> Gary

Or, to view the results, you can call back into Vim using the client-server interface. Some examples (for Windows, but many of the concepts will apply generally) can be found here:

http://vim.wikia.com/wiki/Execute_external_programs_asynchronously_under_Windows

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment