1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 07:40:05 +08:00
SpaceVim/bundle/neco-syntax/autoload/cm/sources/necosyntax.vim
2020-06-13 14:06:35 +08:00

26 lines
678 B
VimL
Vendored

"=============================================================================
" FILE: necosyntax.vim (NCM source)
" AUTHOR: Jia Sui <jsfaint@gmail.com>
" License: MIT license
"=============================================================================
let s:initialized = 0
function! cm#sources#necosyntax#refresh(opt, ctx)
if !s:initialized
call necosyntax#initialize()
let s:initialized = 1
endif
let col = a:ctx['col']
let typed = a:ctx['typed']
let kw = matchstr(typed, '\w\+$')
let kwlen = len(kw)
let matches = necosyntax#gather_candidates()
let startcol = col - kwlen
call cm#complete(a:opt.name, a:ctx, startcol, matches)
endfunction