Skip to content

Instantly share code, notes, and snippets.

@thinker3
Forked from btipling/nvim_clock.py
Last active August 29, 2015 14:17
Show Gist options
  • Save thinker3/8f2002160d2c36c3b6ee to your computer and use it in GitHub Desktop.
Save thinker3/8f2002160d2c36c3b6ee to your computer and use it in GitHub Desktop.
# 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