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.

37 lines
1008B

  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. \ 'on_complete': 'ncm2_khard#on_complete',
  17. \ 'on_warmup': 'ncm2_khard#on_warmup',
  18. \ }, 'keep')
  19. func! ncm2_khard#init()
  20. call ncm2#register_source(g:ncm2_khard#source)
  21. endfunc
  22. func! ncm2_khard#on_warmup(ctx)
  23. call g:ncm2_khard#proc.try_notify('on_warmup', a:ctx)
  24. endfunc
  25. func! ncm2_khard#on_complete(ctx)
  26. call g:ncm2_khard#proc.try_notify('on_complete', a:ctx)
  27. endfunc
  28. func! ncm2_khard#on_event(event)
  29. call g:ncm2_khard#proc.try_notify('on_event', a:event, bufnr('%'))
  30. endfunc