Bladeren bron

First working version

master
Maxime Wack 5 jaren geleden
bovenliggende
commit
efa77d0c48
2 gewijzigde bestanden met toevoegingen van 10 en 12 verwijderingen
  1. +5
    -2
      autoload/ncm2_khard.vim
  2. +5
    -10
      pythonx/ncm2_khard.py

+ 5
- 2
autoload/ncm2_khard.vim Bestand weergeven

@@ -12,7 +12,7 @@ let g:ncm2_khard#source = extend(get(g:, 'ncm2_khard#source', {}), {
\ 'name': 'khard',
\ 'ready': 0,
\ 'priority': 5,
\ 'mark': 'b',
\ 'mark': 'email',
\ 'scope': ['mail'],
\ 'complete_pattern': ['^To: ', '^Cc: ', '^Bcc: '],
\ 'on_complete': 'ncm2_khard#on_complete',
@@ -24,10 +24,13 @@ func! ncm2_khard#init()
endfunc

func! ncm2_khard#on_warmup(ctx)
call g:ncm2_khard#proc.jobstart()
call g:ncm2_khard#proc.try_notify('on_warmup', a:ctx)
endfunc

func! ncm2_khard#on_complete(ctx)
call g:ncm2_khard#proc.try_notify('on_complete', a:ctx)
endfunc

func! ncm2_khard#on_event(event)
call g:ncm2_khard#proc.try_notify('on_event', a:event, bufnr('%'))
endfunc

+ 5
- 10
pythonx/ncm2_khard.py Bestand weergeven

@@ -3,8 +3,6 @@
import vim
import subprocess
from ncm2 import Ncm2Source, getLogger
import re
from copy import deepcopy

logger = getLogger(__name__)

@@ -12,18 +10,15 @@ logger = getLogger(__name__)
class Source(Ncm2Source):

def on_warmup(self, ctx):
shell_command = 'khard email --parsable | cut -f 1,2'
self.dictionary = subprocess.run(shell_command, shell = True, capture_output = True).stdout.decode('utf8').split('\n')
bufnr = ctx['bufnr']
shell_cmd = "khard email --parsable | cut -f 1,2 | sed -r 's/(.*)\t(.*)/\\2 <\\1>/'"
self.matches = subprocess.run(shell_cmd, shell = True, capture_output = True).stdout.decode('utf8').split('\n')

def on_complete(self, ctx):
base = ctx['base']
# matcher = self.matcher_get(ctx)
# matches = []


self.complete(ctx, ctx['startccol'], self.dictionary)
self.complete(ctx, ctx['startccol'], self.matches)


source = Source(vim)

on_warmup = source.on_warmup
on_complete = source.on_complete

Laden…
Annuleren
Opslaan