mirror of
https://github.com/wellle/tmux-complete.vim.git
synced 2025-12-16 12:00:09 +01:00
27 lines
613 B
Python
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
|