Skip to content

Instantly share code, notes, and snippets.

View thinker3's full-sized avatar
🎯
Focusing

Ken Chen thinker3

🎯
Focusing
  • solo
  • Chongqing
View GitHub Profile
@thinker3
thinker3 / snake.py
Last active August 29, 2015 14:17 — forked from tarruda/snake.py
# Snake for Neovim! Adapted from https://gist.github.com/sanchitgangwar/2158084
# To install, create a ~/.vim/rplugin/python/snake.py file with this
# code, then run `nvim -c 'UpdateRemotePlugins' -c 'q'` from a shell.
#
# Make sure you have read the internal help explaining how to setup python
# host for external plugins(:help nvim-python)
#
# To start a new game, use the `:SnakeStart` command on an empty buffer(uses 80
# columns and 20 rows)
from threading import Thread, Lock
# 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
import ctypes
import ctypes.wintypes
import win32con
class GlobalHotKeys(object):
"""
Register a key using the register() method, or using the @register decorator
Use listen() to start the message pump