How to use the pynvim.command 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 svermeulen / nvim-marksman / rplugin / python3 / marksman / Marksman.py View on Github external
    @pynvim.command('MarksmanOpenFirstMatch', nargs='1', range='', sync=True)
    def openFirstMatch(self, args, _):
        self._lazyInit()

        assert len(args) == 2 or len(args) == 1, 'Wrong number of arguments to MarksmanOpenNextMatch'

        rootPath = self._getCanonicalPath(args[0])

        assert os.path.isdir(rootPath), f"Could not find directory '{rootPath}'"

        if len(args) == 1:
            id = ''
        else:
            id = args[1]

        projectInfo = self._getProjectInfo(rootPath)
github svermeulen / nvim-marksman / rplugin / python3 / marksman / Marksman.py View on Github external
    @pynvim.command('MarksmanProfileSearchMethods', nargs='1', range='', sync=True)
    def profileSearchMethods(self, args, _):
        self._lazyInit()

        dirPath = self._getCanonicalPath(args[0])

        for i in range(2):
            self._log.info(f'Round {i+1}:')

            invalidTypes = []

            for searchType in SearchTypes:
                startTime = datetime.now()

                fileIterator = self._tryScanForFilesUsingSearchType(searchType, dirPath, False)

                if not fileIterator:
github svermeulen / nvim-marksman / rplugin / python3 / marksman / Marksman.py View on Github external
    @pynvim.command('MarksmanOpenNextMatch', nargs='1', range='', sync=True)
    def openNextMatch(self, args, _):
        self._lazyInit()

        assert len(args) == 1, 'Wrong number of arguments to MarksmanOpenNextMatch'

        rootPath = self._getCanonicalPath(args[0])

        assert os.path.isdir(rootPath), f"Could not find directory '{rootPath}'"

        projectInfo = self._getProjectInfo(rootPath)

        self._waitForProjectToInitialize(projectInfo)

        currentPath = self._getCanonicalPath(self._nvim.eval('expand("%:p")'))
        id = self._getFileNameHumps(os.path.basename(currentPath))
github numirias / semshi / rplugin / python3 / semshi / plugin.py View on Github external
    @neovim.command('Semshi', nargs='*', complete='customlist,SemshiComplete',
                    sync=True)
    def cmd_semshi(self, args):
        if not args:
            self.echo('This is semshi.')
            return
        try:
            func = _subcommands[args[0]]
        except KeyError:
            self.echo_error('Subcommand not found: %s' % args[0])
            return
        func(self, *args[1:])