#!/usr/bin/env python # -*- coding: utf-8 -*- # For debugging # NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim from cm import cm cm.register_source( name='cm-tmux', abbreviation='Tmux', priority=4, events=['CursorHold', 'CursorHoldI', 'FocusGained', 'BufEnter'], detach=1) import os import re import logging import subprocess logger = logging.getLogger(__name__) class Source: def __init__(self, nvim): self._nvim = nvim if not os.environ['TMUX']: # suiside for tmux not available nvim.call("cm#remove_source", 'cm-tmux')
# -*- coding: utf-8 -*- # For debugging # NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim # detach 1 for quick shutdown for neovim, detach 0, 'cause jedi enters infinite # loops sometime, don't know why. from cm import cm cm.register_source(name='cm-jedi', priority=9, abbreviation='Py', scopes=['python'], events=['InsertLeave'], detach=0) import os import re import logging import jedi from neovim import attach, setup_logging logger = logging.getLogger(__name__) class Source: def __init__(self,nvim): self._nvim = nvim def cm_refresh(self,info,ctx,*args):
# -*- coding: utf-8 -*- # For debugging, use this command to start neovim: # # NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim # # # Please register source before executing any other code, this allow cm_core to # read basic information about the source without loading the whole module, and # modules required by this module from cm import cm cm.register_source(name='cm-filepath', abbreviation='path', priority=6, detach=1) import os import re import logging from neovim.api import Nvim logger = logging.getLogger(__name__) class Source: def __init__(self, nvim): """ @type nvim: Nvim """ self._nvim = nvim
# -*- coding: utf-8 -*- # For debugging # NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim from cm import cm # detach=1 for exit vim quickly cm.register_source(name='cm-gocode', priority=9, abbreviation='Go', scopes=['go'], detach=1) import os import re import logging from neovim import attach, setup_logging import re import subprocess import logging from urllib import request import json from cm import cm logger = logging.getLogger(__name__) class Source: def __init__(self, nvim):
#!/usr/bin/env python # -*- coding: utf-8 -*- # For debugging # NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim from cm import cm cm.register_source(name='cm-tags', priority=6, abbreviation='Tag', events=['WinEnter'], detach=1) import os import re import logging import sys logger = logging.getLogger(__name__) class Source: def __init__(self, nvim): self._nvim = nvim self._kw_pattern = r'[0-9a-zA-Z_]' self._files = self._nvim.call('tagfiles') def cm_event(self, event, ctx, *args): if event == "WinEnter": self._files = self._nvim.call('tagfiles')
#!/usr/bin/env python # -*- coding: utf-8 -*- # For debugging # NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim from cm import cm cm.register_source(name='cm-bufkeyword', priority=5, abbreviation='Key', events=[ 'CursorHold', 'CursorHoldI', 'BufEnter', 'BufWritePost', 'TextChangedI' ], cm_refresh_patterns=[r'[0-9a-zA-Z_#]{3,}$'], detach=1) import os import re import logging logger = logging.getLogger(__name__) class Source: def __init__(self, nvim): self._nvim = nvim self._words = set() self._split_pattern = r'[^0-9a-zA-Z_#]+'
# -*- coding: utf-8 -*- # For debugging # NVIM_PYTHON_LOG_FILE=nvim.log NVIM_PYTHON_LOG_LEVEL=INFO nvim from cm import cm cm.register_source(name='cm-tern', priority=9, abbreviation='Js', scopes=['javascript', 'javascript.jsx'], detach=1) import os import re import logging from neovim import attach, setup_logging import re import subprocess import logging from urllib import request import json from cm import cm logger = logging.getLogger(__name__) class Tern: def __init__(self, bin): proc = subprocess.Popen([bin, '--persistent'], stdin=subprocess.PIPE, stdout=subprocess.PIPE,