You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0KB

  1. if get(s:, 'loaded', 0)
  2. finish
  3. endif
  4. let s:loaded = 1
  5. let g:ncm2_khard#proc = yarp#py3({
  6. \ 'module': 'ncm2_khard',
  7. \ 'on_load': { -> ncm2#set_ready(g:ncm2_khard#source)}
  8. \ })
  9. let g:ncm2_khard#source = extend(get(g:, 'ncm2_khard#source', {}), {
  10. \ 'name': 'khard',
  11. \ 'ready': 0,
  12. \ 'priority': 5,
  13. \ 'mark': 'email',
  14. \ 'scope': ['mail'],
  15. \ 'complete_pattern': ['^To: .*', '^Cc: .*', '^Bcc: .*'],
  16. \ 'complete_length': -1,
  17. \ 'on_complete': 'ncm2_khard#on_complete',
  18. \ 'on_warmup': 'ncm2_khard#on_warmup',
  19. \ }, 'keep')
  20. func! ncm2_khard#init()
  21. call ncm2#register_source(g:ncm2_khard#source)
  22. endfunc
  23. func! ncm2_khard#on_warmup(ctx)
  24. call g:ncm2_khard#proc.try_notify('on_warmup', a:ctx)
  25. endfunc
  26. func! ncm2_khard#on_complete(ctx)
  27. call g:ncm2_khard#proc.try_notify('on_complete', a:ctx)
  28. endfunc
  29. func! ncm2_khard#on_event(event)
  30. call g:ncm2_khard#proc.try_notify('on_event', a:event, bufnr('%'))
  31. endfunc