Files
tmux-complete.vim-mirror/pythonx/ncm2_tmux_complete.py
2018-07-20 17:34:18 +03:00

27 lines
613 B
Python

# -*- coding: utf-8 -*-
import vim
from ncm2 import Ncm2Source, getLogger
from subprocess import check_output
logger = getLogger(__name__)
class Source(Ncm2Source):
def __init__(self, nvim):
super(Source, self).__init__(nvim)
def on_complete(self, ctx):
command = vim.call('tmuxcomplete#getcommand', '', 'words')
words = check_output(['sh', '-c', command]
).decode('utf-8').splitlines()
matches = [{'word': x} for x in words]
self.complete(ctx, ctx['startccol'], matches)
source = Source(vim)
on_complete = source.on_complete