Skip to content

Commit e713269

Browse files
committed
implement &syntax support msanders#40
1 parent ac3b77b commit e713269

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

autoload/snipMate.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ fun! snipMate#RetabSnip() range
683683
endf
684684

685685
fun! snipMate#OpenSnippetFiles()
686-
let scopes = s:AddScopeAliases(split(&ft,'\.'))
686+
let scopes = s:AddScopeAliases(snipMate#ScopesByFile())
687687
let dict = snipMate#GetSnippetFiles(0, scopes, '*')
688688
" sort by files wether they exist - put existing files first
689689
let exists = []
@@ -704,5 +704,10 @@ fun! snipMate#OpenSnippetFiles()
704704
endfor
705705
endf
706706

707+
fun! snipMate#ScopesByFile()
708+
" default implementation to determine scopes based on cursor, filetype,
709+
" syntax setting. Usually &ft and &syntax are the same
710+
return tlib#list#Uniq(split(&ft, '\.') + [&syntax, '_'])
711+
endf
707712

708713
" vim:noet:sw=4:ts=4:ft=vim

doc/snipMate.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ See |snipMate-disambiguation| to learn about how name collisions are handled.
140140
Note that dotted
141141
'filetype' syntax is supported -- e.g., you can use >
142142
143-
:set ft=html.eruby
144-
145-
to activate snippets for both HTML and eRuby for the current file.
143+
:set ft=html.eruby =syntax=sql
144+
to activate snippets for both HTML, eRuby and sql for the current file.
145+
See snipMate#ScopesByFile()
146146

147147
The syntax for snippets in *.snippets files is the following: >
148148

0 commit comments

Comments
 (0)