Python neovim.attach() Examples
The following are 4
code examples of neovim.attach().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
neovim
, or try the search function
.
Example #1
Source File: cm.py From nvim-completion-manager with MIT License | 5 votes |
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
Example #2
Source File: neovim_mod.py From vroom with Apache License 2.0 | 5 votes |
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)
Example #3
Source File: cli.py From python-gui with Apache License 2.0 | 4 votes |
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)
Example #4
Source File: test_plugin.py From pudb.vim with MIT License | 4 votes |
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