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.
 
 

49 lines
1.3 KiB

  1. "=============================================================================
  2. " FILE: neosnippet.vim
  3. " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
  4. " License: MIT license
  5. "=============================================================================
  6. let s:save_cpo = &cpo
  7. set cpo&vim
  8. let s:source = {
  9. \ 'name' : 'neosnippet',
  10. \ 'kind' : 'keyword',
  11. \ 'mark' : '[nsnip]',
  12. \ 'rank' : 8,
  13. \ 'hooks' : {},
  14. \ 'matchers' :
  15. \ (g:neocomplete#enable_fuzzy_completion ?
  16. \ ['matcher_fuzzy'] : ['matcher_head']),
  17. \}
  18. function! s:source.gather_candidates(context) abort "{{{
  19. let snippets = values(neosnippet#helpers#get_completion_snippets())
  20. if matchstr(a:context.input, '\S\+$') !=#
  21. \ matchstr(a:context.input, '\w\+$')
  22. " Word filtering
  23. call filter(snippets, 'v:val.options.word')
  24. endif
  25. return snippets
  26. endfunction"}}}
  27. function! s:source.hooks.on_post_filter(context) abort "{{{
  28. for snippet in a:context.candidates
  29. let snippet.dup = 1
  30. let snippet.menu = neosnippet#util#strwidthpart(
  31. \ snippet.menu_template, winwidth(0)/3)
  32. endfor
  33. return a:context.candidates
  34. endfunction"}}}
  35. function! neocomplete#sources#neosnippet#define() abort "{{{
  36. return s:source
  37. endfunction"}}}
  38. let &cpo = s:save_cpo
  39. unlet s:save_cpo
  40. " vim: foldmethod=marker