25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ncm2_khard.py 602B

123456789101112131415161718192021222324
  1. # -*- coding: utf-8 -*-
  2. import vim
  3. import subprocess
  4. from ncm2 import Ncm2Source, getLogger
  5. logger = getLogger(__name__)
  6. class Source(Ncm2Source):
  7. def on_warmup(self, ctx):
  8. bufnr = ctx['bufnr']
  9. shell_cmd = "khard email --parsable | cut -f 1,2 | sed -r 's/(.*)\t(.*)/\\2 <\\1>/'"
  10. self.matches = subprocess.run(shell_cmd, shell = True, capture_output = True).stdout.decode('utf8').split('\n')
  11. def on_complete(self, ctx):
  12. self.complete(ctx, ctx['startccol'], self.matches)
  13. source = Source(vim)
  14. on_warmup = source.on_warmup
  15. on_complete = source.on_complete