當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。