Skip to content

Instantly share code, notes, and snippets.

@bfredl
Created August 29, 2014 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bfredl/5a008fbe56aae07703c7 to your computer and use it in GitHub Desktop.
Save bfredl/5a008fbe56aae07703c7 to your computer and use it in GitHub Desktop.
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