Why Does Vim Need Threads?

There's a fork of Vim that supports threads (Hacker News discussion, Google Groups post), written by Thiago Arruda. Thiago's approach is to have a thread that captures user input events using a queue, which can then be processed when the main thread is free.

Sometimes Vim appears to lock up: I notice this when I launch The Silver Searcher. It's clear that an external process is being launched, so I just wait until it's done. A multithreaded approach could theoretically get around this: plugins and external programs could be launched while Vim continues to accept user input.

If you read through the vim_dev discussion it quickly becomes clear that this is not a trivial problem. However, the fork has generated a lot of enthusiasm from the community, so it'll be interesting to see where this goes.

blog comments powered by Disqus