当前位置: 首页>>代码示例>>Python>>正文


Python neovim.attach方法代码示例

本文整理汇总了Python中neovim.attach方法的典型用法代码示例。如果您正苦于以下问题:Python neovim.attach方法的具体用法?Python neovim.attach怎么用?Python neovim.attach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在neovim的用法示例。


在下文中一共展示了neovim.attach方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_neovim

# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import attach [as 别名]
def setup_neovim(serveraddr):

    logger.info("connecting to neovim server: %s",serveraddr)
    # create another connection to avoid synchronization issue?
    if len(serveraddr.split(':'))==2:
        serveraddr,port = serveraddr.split(':')
        port = int(port)
        nvim = attach('tcp',address=serveraddr,port=port)
    else:
        nvim = attach('socket',path=serveraddr)

    sync_rtp(nvim)
    return nvim 
开发者ID:roxma,项目名称:nvim-completion-manager,代码行数:15,代码来源:cm.py

示例2: Start

# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import attach [as 别名]
def Start(self):
    """Starts Neovim"""
    self.process = subprocess.Popen(self.start_command, env=self.env)
    start_time = time.time()
    # Wait at most 5s for the Neovim socket
    while not os.path.exists(self.args.servername) \
            and time.time() - start_time < 5:
      time.sleep(0.01)
    self.nvim = neovim.attach('socket', path=self.args.servername) 
开发者ID:google,项目名称:vroom,代码行数:11,代码来源:neovim_mod.py

示例3: main

# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import attach [as 别名]
def main(ctx, prog, notify, listen, connect, font, profile):
    """Entry point."""
    address = connect or listen

    setup_logging("gtk_ui")

    if address:
        import re
        p = re.compile(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?:\:\d{1,5})?$')

        if p.match(address):
            args = ('tcp',)
            kwargs = {'address': address}
        else:
            args = ('socket',)
            kwargs = {'path': address}

    if connect:
        # connect to existing instance listening on address
        nvim = attach(*args, **kwargs)
    elif listen:
        # spawn detached instance listening on address and connect to it
        import os
        import time
        from subprocess import Popen
        os.environ['NVIM_LISTEN_ADDRESS'] = address
        nvim_argv = shlex.split(prog or 'nvim --headless') + ctx.args
        # spawn the nvim with stdio redirected to /dev/null.
        dnull = open(os.devnull)
        p = Popen(nvim_argv, stdin=dnull, stdout=dnull, stderr=dnull)
        dnull.close()
        while p.poll() or p.returncode is None:
            try:
                nvim = attach(*args, **kwargs)
                break
            except IOError:
                # socket not ready yet
                time.sleep(0.050)
    else:
        # spawn embedded instance
        nvim_argv = shlex.split(prog or 'nvim --embed') + ctx.args
        nvim = attach('child', argv=nvim_argv)

    from .gtk_ui import GtkUI
    ui = GtkUI(font)
    bridge = UIBridge()
    bridge.connect(nvim, ui, profile if profile != 'disable' else None, notify) 
开发者ID:neovim,项目名称:python-gui,代码行数:49,代码来源:cli.py

示例4: default_test

# 需要导入模块: import neovim [as 别名]
# 或者: from neovim import attach [as 别名]
def default_test(self):
        '''testFileDetection
        Tests all data files for type and compares the results to the current
        stored results.
        '''
        # try embedding nvim in order to run the tests
        # os.environ['NVIM_LISTEN_ADDRESS']=
        # nvim = neovim.attach('child',
        #     argv=["/usr/bin/env", "nvim", "--embed"])
        nvim = neovim.attach('socket', path='/var/folders/kt/yxsj572j6z18h6gq073_zvdr0000gn/T/nvim1jLDkU/0')
        myplug = vim_pudb.NvimPudb(nvim)
        tv = myplug.sgnname()
        self.assertIsNotNone(tv)
        myplug.set_sgnname('bogus')
        self.assertEquals(myplug.sgnname(), 'bogus')
        myplug.set_sgnname(tv)
        tv = myplug.bpsymbol()
        self.assertIsNotNone(tv)
        myplug.set_bpsymbol('bogus')
        self.assertEquals(myplug.bpsymbol(), 'bogus')
        myplug.set_bpsymbol(tv)
        tv = myplug.hlgroup()
        self.assertIsNotNone(tv)
        myplug.set_lgroup('bogus')
        self.assertEquals(myplug.hlgroup(), 'bogus')
        myplug.set_lgroup(tv)
        tv = myplug.launcher()
        self.assertIsNotNone(tv)
        myplug.set_launcher('bogus')
        self.assertEquals(myplug.launcher(), 'bogus')
        myplug.set_launcher(tv)
        tv = myplug.nvim_python()
        self.assertIsNotNone(tv)
        tv = myplug.nvim_python3()
        self.assertIsNotNone(tv)
        tv = myplug.entrypoint()
        self.assertIsNotNone(tv)
        myplug.set_entrypoint('bogus')
        self.assertEquals(myplug.entrypoint(), 'bogus')
        myplug.set_entrypoint(tv)
        tv = myplug.cbname()
        self.assertIsNotNone(tv)
        # test setting the venv
        myplug.set_curbuff_as_entrypoint_with_venv(
            buffname='/Users/magregor/src/pudb.vim/test/test_plugin.py')


# stand-alone test execution 
开发者ID:SkyLeach,项目名称:pudb.vim,代码行数:50,代码来源:test_plugin.py


注:本文中的neovim.attach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。