- Improved syntax file.

This commit is contained in:
Shougo Matsushita 2013-04-11 10:46:19 +09:00
parent b720f96c2c
commit 88663d2e96
2 changed files with 73 additions and 45 deletions

View File

@ -772,6 +772,9 @@ A:
============================================================================== ==============================================================================
CHANGELOG *neosnippet-changelog* CHANGELOG *neosnippet-changelog*
2013-04-11
- Improved syntax file.
2013-04-02 2013-04-02
- Improved escape placeholder behavior. - Improved escape placeholder behavior.

View File

@ -1,5 +1,5 @@
"============================================================================= "=============================================================================
" FILE: syntax/snippet.vim " FILE: syntaxtax/snippet.vim
" AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com> " AUTHOR: Shougo Matsushita <Shougo.Matsu@gmail.com>
" Last Modified: 15 Sep 2010 " Last Modified: 15 Sep 2010
" License: MIT license {{{ " License: MIT license {{{
@ -29,58 +29,83 @@ set cpo&vim
if version < 700 if version < 700
syntax clear syntax clear
elseif exists("b:current_syntax") elseif exists("b:current_syntaxtax")
finish finish
endif endif
syn region neosnippetString start=+'+ end=+'+ contained syntax region neosnippetString
syn region neosnippetString start=+"+ end=+"+ contained \ start=+'+ end=+'+ contained
syn region neosnippetEval start=+\\\@<!`+ end=+\\\@<!`+ contained syntax region neosnippetString
syn match neosnippetWord '^\s\+.*$' contains= \ start=+"+ end=+"+ contained
syntax region neosnippetEval
\ start=+\\\@<!`+ end=+\\\@<!`+ contained
syntax match neosnippetWord
\'^\s\+.*$' contains=
\neosnippetEval,neosnippetPlaceHolder,neosnippetEscape,neosnippetVariable \neosnippetEval,neosnippetPlaceHolder,neosnippetEscape,neosnippetVariable
syn match neosnippetPlaceHolder '\\\@<!\${\d\+\%(:.\{-}\)\?\\\@<!}' syntax match neosnippetPlaceHolder
\'\\\@<!\${\d\+\%(:.\{-}\)\?\\\@<!}'
\ contained contains=neosnippetPlaceHolderComment \ contained contains=neosnippetPlaceHolderComment
syn match neosnippetVariable '\\\@<!\$\d\+' contained syntax match neosnippetVariable
syn match neosnippetComment '^#.*$' \'\\\@<!\$\d\+' contained
syn match neosnippetEscape '\\[`]' contained syntax match neosnippetComment
\'^#.*$'
syntax match neosnippetEscape
\'\\[`]' contained
syn match neosnippetKeyword syntax match neosnippetKeyword
\'^\%(include\|snippet\|abbr\|prev_word\|delete\|alias\|options\|regexp\|TARGET\)' contained \'^\%(include\|snippet\|abbr\|prev_word\|delete\|alias\|options\|regexp\|TARGET\)' contained
syn keyword neosnippetOption head word contained syntax keyword neosnippetOption
syn match neosnippetPrevWords '^prev_word\s\+.*$' contains=neosnippetString,neosnippetKeyword \ head word indent contained
syn match neosnippetRegexpr '^regexp\s\+.*$' contains=neosnippetString,neosnippetKeyword syntax match neosnippetPrevWords
syn match neosnippetStatementName '^snippet\s.*$' contains=neosnippetName,neosnippetKeyword \'^prev_word\s\+.*$' contains=neosnippetString,neosnippetKeyword
syn match neosnippetName '\s\+.*$' contained syntax match neosnippetRegexpr
syn match neosnippetStatementAbbr '^abbr\s.*$' contains=neosnippetAbbr,neosnippetKeyword \'^regexp\s\+.*$' contains=neosnippetString,neosnippetKeyword
syn match neosnippetAbbr '\s\+.*$' contained syntax match neosnippetStatementName
syn match neosnippetStatementRank '^rank\s.*$' contains=neosnippetRank,neosnippetKeyword \'^snippet\s.*$' contains=neosnippetName,neosnippetKeyword
syn match neosnippetRank '\s\+\d\+$' contained syntax match neosnippetName
syn match neosnippetStatementInclude '^include\s.*$' contains=neosnippetInclude,neosnippetKeyword \'\s\+.*$' contained
syn match neosnippetInclude '\s\+.*$' contained syntax match neosnippetStatementAbbr
syn match neosnippetStatementDelete '^delete\s.*$' contains=neosnippetDelete,neosnippetKeyword \'^abbr\s.*$' contains=neosnippetAbbr,neosnippetKeyword
syn match neosnippetDelete '\s\+.*$' contained syntax match neosnippetAbbr
syn match neosnippetStatementAlias '^alias\s.*$' contains=neosnippetAlias,neosnippetKeyword \'\s\+.*$' contained
syn match neosnippetAlias '\s\+.*$' contained syntax match neosnippetStatementRank
syn match neosnippetStatementOptions '^options\s.*$' contains=neosnippetOption,neosnippetKeyword \'^rank\s.*$' contains=neosnippetRank,neosnippetKeyword
syn match neosnippetPlaceHolderComment '{\d\+:\zs#:.\{-}\ze\\\@<!}' contained syntax match neosnippetRank
\'\s\+\d\+$' contained
syntax match neosnippetStatementInclude
\'^include\s.*$' contains=neosnippetInclude,neosnippetKeyword
syntax match neosnippetInclude
\'\s\+.*$' contained
syntax match neosnippetStatementDelete
\'^delete\s.*$' contains=neosnippetDelete,neosnippetKeyword
syntax match neosnippetDelete
\'\s\+.*$' contained
syntax match neosnippetStatementAlias
\'^alias\s.*$' contains=neosnippetAlias,neosnippetKeyword
syntax match neosnippetAlias
\'\s\+.*$' contained
syntax match neosnippetStatementOptions
\'^options\s.*$' contains=neosnippetOption,neosnippetKeyword
syntax match neosnippetPlaceHolderComment
\'{\d\+:\zs#:.\{-}\ze\\\@<!}' contained
hi def link neosnippetKeyword Statement highlight def link neosnippetKeyword Statement
hi def link neosnippetString String highlight def link neosnippetString String
hi def link neosnippetName Identifier highlight def link neosnippetName Identifier
hi def link neosnippetAbbr Normal highlight def link neosnippetAbbr Normal
hi def link neosnippetEval Type highlight def link neosnippetEval Type
hi def link neosnippetWord String highlight def link neosnippetWord String
hi def link neosnippetPlaceHolder Special highlight def link neosnippetPlaceHolder Special
hi def link neosnippetPlaceHolderComment Comment highlight def link neosnippetPlaceHolderComment Comment
hi def link neosnippetVariable Special highlight def link neosnippetVariable Special
hi def link neosnippetComment Comment highlight def link neosnippetComment Comment
hi def link neosnippetInclude PreProc highlight def link neosnippetInclude PreProc
hi def link neosnippetDelete PreProc highlight def link neosnippetDelete PreProc
hi def link neosnippetOption PreProc highlight def link neosnippetOption PreProc
hi def link neosnippetAlias Identifier highlight def link neosnippetAlias Identifier
hi def link neosnippetEscape Special highlight def link neosnippetEscape Special
let b:current_syntax = "snippet" let b:current_syntaxtax = "snippet"
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo