1 "=============================================================================
2 " FILE: syntax/snippet.vim
3 " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>(Modified)
4 " Last Modified: 08 Nov 2009
5 " Usage: Just source this file.
6 " License: MIT license {{{
7 " Permission is hereby granted, free of charge, to any person obtaining
8 " a copy of this software and associated documentation files (the
9 " "Software"), to deal in the Software without restriction, including
10 " without limitation the rights to use, copy, modify, merge, publish,
11 " distribute, sublicense, and/or sell copies of the Software, and to
12 " permit persons to whom the Software is furnished to do so, subject to
13 " the following conditions:
15 " The above copyright notice and this permission notice shall be included
16 " in all copies or substantial portions of the Software.
18 " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 " Version: 1.5, for Vim 7.0
27 "-----------------------------------------------------------------------------
30 " - Deleted rank and condition.
34 " - Implemented optional placeholder.
49 "-----------------------------------------------------------------------------
56 "=============================================================================
60 elseif exists("b:current_syntax")
64 syn region SnippetPrevWord start=+'+ end=+'+ contained
65 syn region SnippetPrevWord start=+"+ end=+"+ contained
66 syn region SnippetEval start=+`+ end=+`+ contained
67 syn match SnippetWord '^\s\+.*$' contains=SnippetEval,SnippetExpand
68 syn match SnippetExpand '\${\d\+\%(:.\{-}\)\?\\\@<!}' contained
69 syn match SnippetVariable '\$\d\+' contained
70 syn match SnippetComment '^#.*$'
72 syn match SnippetKeyword '^\%(include\|snippet\|abbr\|prev_word\|delete\|alias\)' contained
73 syn match SnippetPrevWords '^prev_word\s\+.*$' contains=SnippetPrevWord,SnippetKeyword
74 syn match SnippetStatementName '^snippet\s.*$' contains=SnippetName,SnippetKeyword
75 syn match SnippetName '\s\+.*$' contained
76 syn match SnippetStatementAbbr '^abbr\s.*$' contains=SnippetAbbr,SnippetKeyword
77 syn match SnippetAbbr '\s\+.*$' contained
78 syn match SnippetStatementRank '^rank\s.*$' contains=SnippetRank,SnippetKeyword
79 syn match SnippetRank '\s\+\d\+$' contained
80 syn match SnippetStatementInclude '^include\s.*$' contains=SnippetInclude,SnippetKeyword
81 syn match SnippetInclude '\s\+.*$' contained
82 syn match SnippetStatementDelete '^delete\s.*$' contains=SnippetDelete,SnippetKeyword
83 syn match SnippetDelete '\s\+.*$' contained
84 syn match SnippetStatementAlias '^alias\s.*$' contains=SnippetAlias,SnippetKeyword
85 syn match SnippetAlias '\s\+.*$' contained
87 hi def link SnippetKeyword Statement
88 hi def link SnippetPrevWord String
89 hi def link SnippetName Identifier
90 hi def link SnippetAbbr Normal
91 hi def link SnippetEval Type
92 hi def link SnippetWord String
93 hi def link SnippetExpand Special
94 hi def link SnippetVariable Special
95 hi def link SnippetComment Comment
96 hi def link SnippetInclude PreProc
97 hi def link SnippetDelete PreProc
98 hi def link SnippetAlias Identifier
100 let b:current_syntax = "snippet"