diff --git a/autoload/neosnippet/commands.vim b/autoload/neosnippet/commands.vim index c113e02..4246a88 100644 --- a/autoload/neosnippet/commands.vim +++ b/autoload/neosnippet/commands.vim @@ -1,7 +1,7 @@ "============================================================================= " FILE: commands.vim " AUTHOR: Shougo Matsushita -" 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"}}}