Improve snippet initialization

This commit is contained in:
Shougo Matsushita 2014-01-01 10:22:03 +09:00
parent 46fa8a9c2c
commit 622a691785
1 changed files with 10 additions and 12 deletions

View File

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