Last active
August 29, 2015 14:08
-
-
Save btipling/0d6faa80b24ccee5caea to your computer and use it in GitHub Desktop.
This file contains 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
# Put this in ~/.nvim/pythonx/ | |
# requires python, see :he nvim-python | |
from threading import Thread | |
from time import sleep, strftime | |
class EventLoop(Thread): | |
def __init__(self, vim): | |
super(EventLoop, self).__init__() | |
self.vim = vim | |
def run(self): | |
while True: | |
sleep(0.1) | |
self.vim.session.post('tick') | |
class NvimClock(object): | |
def __init__(self, vim): | |
self.vim = vim | |
self.eventLoop = EventLoop(vim) | |
self.eventLoop.start() | |
def on_tick(self): | |
self.vim.command('set statusline=%s' % (strftime("%H:%M:%S"),)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to run this file? I found two snake.py, one of them can run as it said in the doc.
but this file seems not working even put in ~/.nvim/pythonx/