Skip to content

Instantly share code, notes, and snippets.

@mhinz
Created July 19, 2016 15:23
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 mhinz/3e962884e41726ed93aa52a827e0de19 to your computer and use it in GitHub Desktop.
Save mhinz/3e962884e41726ed93aa52a827e0de19 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
import os
from neovim import attach
# WORKING:
def make_func(num):
def func():
num -= 1
print(num)
return func
try:
make_func(5)()
except UnboundLocalError as e:
print('As expected: ' + str(e))
# NOT WORKING:
def setup_cb():
nvim.command('call rpcnotify({}, "foo")'.format(nvim.channel_id))
def make_notification_cb(num):
def notification_cb(msg, _args):
# num -= 1
print(str(num))
nvim.stop_loop()
return notification_cb
notification_cb = make_notification_cb(5)
nvim = attach('child', argv=['nvim', '-u', 'NONE', '--embed'])
nvim.run_loop(None, notification_cb, setup_cb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment