From c3327c821d7b8672acba15964d4418bf96dcd1bc Mon Sep 17 00:00:00 2001 From: Michael Sanders Date: Sun, 29 Mar 2009 18:03:44 -0400 Subject: [PATCH] added support for hyphenated global snippets (_-foo) --- after/plugin/snipMate.vim | 9 ++------- plugin/snipMate.vim | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/after/plugin/snipMate.vim b/after/plugin/snipMate.vim index e2f23a2..239ca84 100644 --- a/after/plugin/snipMate.vim +++ b/after/plugin/snipMate.vim @@ -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 diff --git a/plugin/snipMate.vim b/plugin/snipMate.vim index dbdf03b..d9c3ccb 100644 --- a/plugin/snipMate.vim +++ b/plugin/snipMate.vim @@ -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")