-
-
Save thinker3/8f2002160d2c36c3b6ee 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