Features by Gerhard
[shutils.git] / dotfiles / vim / .vim / syntax / snippet.vim
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:
14 "
15 " The above copyright notice and this permission notice shall be included
16 " in all copies or substantial portions of the Software.
17 "
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.
25 " }}}
26 " Version: 1.5, for Vim 7.0
27 "-----------------------------------------------------------------------------
28 " ChangeLog: "{{{
29 " 1.5:
30 " - Deleted rank and condition.
31 "
32 " 1.4:
33 " - Added condition.
34 " - Implemented optional placeholder.
35 "
36 " 1.3:
37 " - Added variable.
38 "
39 " 1.2:
40 " - Added alias.
41 " - Improved color.
42 "
43 " 1.1:
44 " - Added delete.
45 "
46 " 1.0:
47 " - Initial version.
48 ""}}}
49 "-----------------------------------------------------------------------------
50 " TODO: "{{{
51 " - Nothing.
52 ""}}}
53 " Bugs"{{{
54 " -
55 ""}}}
56 "=============================================================================
57
58 if version < 700
59 syntax clear
60 elseif exists("b:current_syntax")
61 finish
62 endif
63
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 '^#.*$'
71
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
86
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
99
100 let b:current_syntax = "snippet"