GithubHelp home page GithubHelp logo

vtpp / vim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tarruda/vim

0.0 2.0 0.0 129.08 MB

Fork with multithreading support

Home Page: https://groups.google.com/forum/#!topic/vim_dev/65jjGqS1_VQ

vim's Introduction

An experimental vim fork with multi-threading capabilities.

Vim code still only executes in the main thread, but a thread-safe queue is provided that other threads can use to notify vim main loop about events.

Events published to the queue will be executed as 'User' autocommands with the filename matching the event name and v:event_arg as a string argument(empty string if no arguments were passed to the event).

Here's a simple example:

" This only works if vim is compiled with --enable-eventloop
if has('event_loop')

python << EOF
import vim
from threading import Thread
from time import sleep

def run():
    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 when vim exits
t.start()
EOF

function! Notify()
python << EOF
vim.current.buffer.append(vim.eval('v:event_arg'))
EOF
endfunction

au User my-custom-event call Notify()

endif

Instructions:

First make sure you have python development headers as right now only through python scripting a plugin can access the event loop(I plan to add vimscript functions that make use of the event loop once its more stable).

On ubuntu enter sudo apt-get install python-dev to install the necessary headers. Then clone/compile:

git clone git://github.com/tarruda/vim
cd vim
make distclean
(cd src && make autoconf)
./configure --enable-pythoninterp --enable-eventloop --with-features=huge
make

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 will do my best to keep it in sync with the official repository.

Plugin authors can test if this feature with has('event_loop') as shown in the example above.

vim's People

Contributors

brammool avatar tarruda avatar ashleyh avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.