1
0
mirror of https://github.com/gryf/snipmate.vim.git synced 2025-12-29 09:52:36 +01:00

added support for hyphenated global snippets (_-foo)

This commit is contained in:
Michael Sanders
2009-03-29 18:03:44 -04:00
parent f8ba98c38b
commit c3327c821d
2 changed files with 4 additions and 9 deletions

View File

@@ -17,12 +17,7 @@ if empty(snippets_dir) || !isdirectory(snippets_dir)
finish
endif
if isdirectory(snippets_dir.'_')
call ExtractSnips(snippets_dir.'_', '_')
endif
if filereadable(snippets_dir.'_.snippets')
call ExtractSnipsFile(snippets_dir.'_.snippets')
endif
call GetSnippets(snippets_dir, '_') " Get global snippets
au FileType * if &ft != 'help' | call GetSnippets(g:snippets_dir) | endif
au FileType * if &ft != 'help' | call GetSnippets(snippets_dir, &ft) | endif
" vim:noet:sw=4:ts=4:ft=vim

View File

@@ -103,8 +103,8 @@ fun! ResetSnippets()
endf
let g:did_ft = {}
fun! GetSnippets(dir)
for ft in split(&ft, '\.')
fun! GetSnippets(dir, filetype)
for ft in split(a:filetype, '\.')
if has_key(g:did_ft, ft) | continue | endif
for path in split(globpath(a:dir, ft.'/')."\n".
\ globpath(a:dir, ft.'-*/'), "\n")