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.
 
 

41 lines
1.2 KiB

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