Python源码示例:neovim.plugin()

示例1
def __init__(self, vim):
        self._vim = vim
        self._tandem = plugin.TandemPlugin(
            vim=vim,
            message_handler=self._handle_message,
        )
        self._text_applied = Event()
        self._message = None 
示例2
def session(self, args):
        if not plugin.is_active:
            self._vim.async_call(
                lambda: self._vim.command('echom "No instance running."'),
            )
            return
        self._vim.async_call(
            lambda: self._vim.command('echom "Session ID: {}"'
                                      .format(self._session_id)),
        ) 
示例3
def on_text_changed(self):
        if not plugin.is_active:
            return
        self._tandem.check_buffer() 
示例4
def on_text_changed_i(self):
        if not plugin.is_active:
            return
        self._tandem.check_buffer() 
示例5
def pudb_status(self):
        """pudb_status
        print the status of this plugin to :messages in neovim"""
        __logger__.info('{}\n'.format(
            pprint.pformat(self._bps_placed)))
        __logger__.info('{}\n'.format(pprint.pformat(
            [type(self), self._hlgroup, self.nvim]))) 
示例6
def ensime_init_path():
    path = os.path.abspath(inspect.getfile(inspect.currentframe()))
    expected_nvim_path_end = os.path.join('rplugin', 'python3', 'ensime.py')
    expected_vim_path_end = os.path.join('autoload', 'ensime.vim.py')
    if path.endswith(expected_nvim_path_end):  # nvim rplugin
        sys.path.append(os.path.join(
            os.path.dirname(os.path.dirname(os.path.dirname(path)))))
    elif path.endswith(expected_vim_path_end):  # vim plugin
        sys.path.append(os.path.join(
            os.path.dirname(os.path.dirname(path)))) 
示例7
def handle_lock(plugin):
    try:
        yield
    except NoDiscordClientError:
        plugin.locked = True
        plugin.log_warning("local discord client not found")
    except ReconnectError:
        plugin.locked = True
        plugin.log_error("ran out of reconnect attempts")