Improve snippet initialization

This commit is contained in:
Shougo Matsushita 2014-01-01 10:22:03 +09:00
parent 46fa8a9c2c
commit 622a691785

View File

@ -1,7 +1,7 @@
"============================================================================= "=============================================================================
" FILE: commands.vim " FILE: commands.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 25 Dec 2013. " Last Modified: 01 Jan 2014.
" License: MIT license {{{ " License: MIT license {{{
" Permission is hereby granted, free of charge, to any person obtaining " Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the " a copy of this software and associated documentation files (the
@ -99,19 +99,17 @@ function! neosnippet#commands#_make_cache(filetype) "{{{
return return
endif endif
let snippets_dir = neosnippet#helpers#get_snippets_directory() let path = join(neosnippet#helpers#get_snippets_directory(), ',')
let snippet = {} let snippets_files = []
let snippets_files = for glob in [filetype.'.snip*', filetype.'_*.snip*',
\ split(globpath(join(snippets_dir, ','), \ filetype . '/**/*.snip*']
\ filetype . '.snip*'), '\n') let snippets_files += split(globpath(path, glob), '\n')
\ + split(globpath(join(snippets_dir, ','),
\ filetype . '_*.snip*'), '\n')
\ + split(globpath(join(snippets_dir, ','),
\ filetype . '/**/*.snip*'), '\n')
for snippets_file in reverse(snippets_files)
call neosnippet#parser#_parse(snippet, snippets_file)
endfor endfor
let snippet = {}
call map(reverse(snippets_files),
\ "neosnippet#parser#_parse(snippet, v:val)")
let snippets = neosnippet#variables#snippets() let snippets = neosnippet#variables#snippets()
let snippets[filetype] = snippet let snippets[filetype] = snippet
endfunction"}}} endfunction"}}}