@@ -37,6 +37,11 @@ let s:snipMate['get_snippets'] = get(s:snipMate, 'get_snippets', funcref#Functio
3737" directories in &rtp/snippets/*
3838let s: snipMate [' snippet_dirs' ] = get (s: snipMate , ' snippets_dirs' , funcref#Function (' return split(&runtimepath,",")' ))
3939
40+ " _ is default scope added always
41+ "
42+ " &ft honors multiple filetypes and syntax such as in set ft=html.javascript syntax=FOO
43+ let s: snipMate [' get_scopes' ] = get (s: snipMate , ' get_scopes' , funcref#Function (' return split(&ft,"\\.")+[&syntax, "_"]' ))
44+
4045if ! exists (' snippets_dir' )
4146 let snippets_dir = substitute (globpath (&rtp , ' snippets/' ), " \n " , ' ,' , ' g' )
4247endif
@@ -153,7 +158,7 @@ fun! s:GetSnippet(word)
153158 " prefer longest word
154159 for word in lookups
155160 " echomsg string(lookups).' current: '.word
156- let snippetD = get (funcref#Call (s: snipMate [' get_snippets' ], [split (& ft , ' \. ' ) + [ ' _ ' ] , word.' *' ]), word, {})
161+ let snippetD = get (funcref#Call (s: snipMate [' get_snippets' ], [snipMate#ScopesByFile () , word.' *' ]), word, {})
157162 if ! empty (snippetD)
158163 let s = s: ChooseSnippet (snippetD)
159164 if type (s ) == type ([])
@@ -204,7 +209,7 @@ fun! ShowAvailableSnips()
204209 endif
205210 let matchlen = 0
206211 let matches = []
207- let snips = funcref#Call (s: snipMate [' get_snippets' ], [split (& ft , ' \. ' ) + [ ' _ ' ] , word.' *' ])
212+ let snips = funcref#Call (s: snipMate [' get_snippets' ], [snipMate#ScopesByFile () , word.' *' ])
208213
209214
210215 for trigger in keys (snips)
0 commit comments