Fix #392 filetype problem
This commit is contained in:
parent
d6333c191b
commit
4bf88a9e49
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user