Created
August 29, 2014 13:48
-
-
Save bfredl/5a008fbe56aae07703c7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import neovim | |
from threading import Thread | |
from time import sleep | |
vim = neovim.connect(sys.argv[1]) | |
buf = vim.current.buffer | |
def thread(): | |
sleep(0.2) | |
for i in range(100): | |
sleep(0.001) | |
vim.post("test_msg", i) | |
t = Thread(target=thread) | |
t.start() | |
buf = vim.current.buffer | |
while True: | |
kind,name,arg = vim.next_message() | |
if name == "test_msg": | |
val = buf[-1] | |
assert val is not None | |
buf[-1:] = [ val, "text"] | |
if arg == 99: break | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment