-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
__init__.py
39 lines (29 loc) · 1.2 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# ============================================================================
# FILE: __init__.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
import typing
from importlib.util import find_spec
if find_spec('yarp'):
import vim
elif find_spec('pynvim'):
import pynvim as vim
from pynvim import Nvim
if hasattr(vim, 'plugin'):
# Neovim only
from deoppet.deoppet import Deoppet
@vim.plugin
class DeoppetHandlers(object):
def __init__(self, vim: Nvim) -> None:
self._vim = vim
@vim.function('_deoppet_init', sync=False) # type: ignore
def init_channel(self, args: typing.List[str]) -> None:
self._vim.vars['deoppet#_channel_id'] = self._vim.channel_id
self._deoppet = Deoppet(self._vim)
@vim.function('_deoppet_mapping', sync=True) # type: ignore
def mapping(self, args: typing.List[str]) -> None:
self._deoppet.mapping(args[0])
@vim.function('_deoppet_event', sync=True) # type: ignore
def event(self, args: typing.List[str]) -> None:
self._deoppet.event(args[0])