- Notifications
You must be signed in to change notification settings - Fork7
Fork with multithreading support
tarruda/vim
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
An experimental vim fork with multi-threading capabilities.
Vim code still only executes in the main thread, but a thread-safe queue isprovided that other threads can use to notify vim main loop about events.
Events published to the queue will be executed as'User'autocommandswith the filename matching the event name and v:event_arg as a stringargument(empty string if no arguments were passed to the event).
Here's a simple example:
" This only works if vim is compiled with --enable-eventloopifhas('event_loop')python << EOFimportvimfrom threadingimport Threadfrom timeimportsleepdefrun():while True:sleep(1)vim.trigger('my-custom-event','this message came from another thread!')t=Thread(target=run)t.daemon= True # Only daemon threads will be killed whenvim exitst.start()EOFfunction!Notify()python << EOFvim.current.buffer.append(vim.eval('v:event_arg'))EOFendfunctionauUsermy-custom-eventcallNotify()endif
Instructions:
First make sure you have python development headers as right now only throughpython scripting a plugin can access the event loop(I plan to add vimscriptfunctions that make use of the event loop once its more stable).
On ubuntu entersudo apt-get install python-dev
to install the necessaryheaders. Then clone/compile:
git clone git://github.com/tarruda/vimcd vimmake distclean(cd src&& make autoconf)./configure --enable-pythoninterp --enable-eventloop --with-features=hugemake
After compilation enter./src/vim --version
and it should output+event_loop as an included feature.
A more complex demonstration is included in the branch:
./src/vim -u snake.vim
or
./src/vim -U snake.vim -g
There's no guarantee that this will ever get merged with mainline but I willdo my best to keep it in sync with the official repository.
Plugin authors can test if this feature withhas('event_loop')
as shownin the example above.
About
Fork with multithreading support
Resources
Stars
Watchers
Forks
Packages0
Languages
- C52.6%
- Vim Script44.4%
- IDL0.9%
- Objective-C0.6%
- C++0.6%
- Perl0.3%
- Other0.6%