How to use the pynvim.autocmd function in pynvim

To help you get started, we’ve selected a few pynvim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github numirias / semshi / test / helperplugin / rplugin / python3 / __init__.py View on Github external
    @neovim.autocmd('VimEnter', pattern='*', sync=True)
    def event_vim_enter(self):
        """Find and retain the plugin instance."""
        # Don't import semshi on top so it's not collected as a plugin again
        from semshi.plugin import Plugin
        # Using the garbage collector interface to find the instance is a bit
        # hacky, but works reasonably well and doesn't require changes to the
        # plugin code itself.
        for obj in gc.get_objects():
            if isinstance(obj, Plugin):
                self._plugin = obj
                return
        raise Exception('Can\'t find plugin instance.')
github svermeulen / nvim-marksman / rplugin / python3 / marksman / Marksman.py View on Github external
    @pynvim.autocmd('BufEnter', pattern='*', eval='expand("")')
    def onBufEnter(self, path):
        if not self._hasInitialized:
            return
        try:
            self._onBufEnterInternal(path)
        except Exception as e:
            self._log.exception(e)
github numirias / semshi / rplugin / python3 / semshi / plugin.py View on Github external
    @neovim.autocmd('VimLeave', sync=True)
    def event_vim_leave(self):
        for handler in self._handlers.values():
            handler.shutdown()