Fix #392 filetype problem

这个提交包含在:
Shougo Matsushita 2017-07-15 13:39:24 +09:00
父节点 d6333c191b
当前提交 4bf88a9e49
共有 2 个文件被更改,包括 19 次插入1 次删除

查看文件

@ -178,7 +178,7 @@ function! s:get_sources_filetypes(filetype) abort "{{{
\ exists('*context_filetype#get_filetypes') ?
\ context_filetype#get_filetypes(a:filetype) :
\ split(((a:filetype == '') ? 'nothing' : a:filetype), '\.')
return ['_'] + filetypes
return neosnippet#util#uniq(['_', a:filetype] + filetypes)
endfunction"}}}
" vim: foldmethod=marker

查看文件

@ -144,4 +144,22 @@ function! neosnippet#util#option2list(str) abort "{{{
return type(a:str) == type('') ? split(a:str, '\s*,\s*') : a:str
endfunction"}}}
function! neosnippet#util#uniq(list) abort
let list = copy(a:list)
let i = 0
let seen = {}
while i < len(list)
let key = list[i]
if key !=# '' && has_key(seen, key)
call remove(list, i)
else
if key !=# ''
let seen[key] = 1
endif
let i += 1
endif
endwhile
return list
endfunction
" vim: foldmethod=marker