News for hackers. Stuff that matters.
Re:Vim Git Gutter by airblade on Tuesday March 05, 2013 @02:20PM (#5326680)
As far as I know Vim is single-threaded; you can't run operations asynchronously.
Re:Vim Git Gutter by mercurial on Tuesday March 05, 2013 @02:35PM (#5326773)
That's neither here not there. You have plenty of things which are single threaded but allow concurrency (Twisted, NodeJS...). That it does not have an asynchronous API is something different.
Re:Vim Git Gutter by shuzchen on Tuesday March 05, 2013 @02:57PM (#5326922)
Yes, but there is a way to work around that with a ton of hacks (by spawning a separate process, and polling CursorHold events). See https://github.com/troydm/shellasync.vim and a bunch of linting plugins do this too (but I can't remember them off the top of my head).
Re:Vim Git Gutter by gngeal on Tuesday March 05, 2013 @03:09PM (#5327001)
Or you could, e.g., use the Lua scripting extension, load one of the native threading libraries for Lua (Lua Lanes, for example) and fire away a few background tasks. Whatever actions the background tasks need to perform with the buffers you'd have to serialize, but that shouldn't be all that difficult.
Re:Vim Git Gutter by shuzchen on Tuesday March 05, 2013 @03:31PM (#5327130)
So long as any plugin script is running, vim will block waiting for it. And if you fire off a background process and exit from your main script, any reference to the vim environment within your child process becomes useless, so you can't modify anything in vim from within there anymore. I'm not entirely familiar with the lua scripting extension, but this was my experience attempting the same thing in python. I mean, at the end of it, vim is single threaded, and after your primary script exits its state is being used elsewhere - if you could modify it from your child process that'd be major cause for crashage.

That and who has lua on their system (I mean, i do for Love but that's irrelevant) or wants to install it just to use a git/hg plugin?

Re:Vim Git Gutter by gngeal on Tuesday March 05, 2013 @04:27PM (#5327466)
You'd have to implement a message queue, of course. As for the second part, who hasn't? Many applications are using Lua as we speak.
Re:Vim Git Gutter by pydave on Tuesday March 05, 2013 @09:03PM (#5328843)
For the second part, your plugin is written in Python, so you could use Python instead of Lua.