Mercurial > hg > RemoteEditor > vim7
diff runtime/syntax/zsh.vim @ 34:e170173ecb68 current-release
before ack base protocol.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 26 Nov 2008 15:02:10 +0900 |
parents | 76efa0be13f1 |
children | c16898406ff2 |
line wrap: on
line diff
--- a/runtime/syntax/zsh.vim Mon Nov 10 01:13:56 2008 +0000 +++ b/runtime/syntax/zsh.vim Wed Nov 26 15:02:10 2008 +0900 @@ -1,7 +1,7 @@ " Vim syntax file " Language: Zsh shell script " Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-08-06 +" Latest Revision: 2008-07-17 if exists("b:current_syntax") finish @@ -10,7 +10,7 @@ let s:cpo_save = &cpo set cpo&vim -setlocal iskeyword=@,48-57,_,- +setlocal iskeyword+=- syn keyword zshTodo contained TODO FIXME XXX NOTE @@ -34,7 +34,9 @@ syn keyword zshConditional if then elif else fi case in esac select -syn keyword zshRepeat for while until repeat foreach +syn keyword zshRepeat while until repeat + +syn keyword zshRepeat for foreach nextgroup=zshVariable skipwhite syn keyword zshException always @@ -49,19 +51,30 @@ syn match zshRedir '\d\=\(>\|>>\|>&\s*[0-9p-]\=\|&>\|>>&\|&>>\)[|!]\=' syn match zshRedir '|&\=' -syn region zshHereDoc matchgroup=zshRedir start='<<\s*\z(\S*\)' - \ end='^\z1\>' contains=@zshSubst -syn region zshHereDoc matchgroup=zshRedir start='<<-\s*\z(\S*\)' - \ end='^\s*\z1\>' contains=@zshSubst +syn region zshHereDoc matchgroup=zshRedir + \ start='<\@<!<<\s*\z([^<]\S*\)' + \ end='^\z1\>' + \ contains=@zshSubst +syn region zshHereDoc matchgroup=zshRedir + \ start='<\@<!<<\s*\\\z(\S\+\)' + \ end='^\z1\>' + \ contains=@zshSubst syn region zshHereDoc matchgroup=zshRedir - \ start=+<<\s*\(["']\)\z(\S*\)\1+ end='^\z1\>' + \ start='<\@<!<<-\s*\\\=\z(\S\+\)' + \ end='^\s*\z1\>' + \ contains=@zshSubst syn region zshHereDoc matchgroup=zshRedir - \ start=+<<-\s*\(["']\)\z(\S*\)\1+ + \ start=+<\@<!<<\s*\(["']\)\z(\S\+\)\1+ + \ end='^\z1\>' +syn region zshHereDoc matchgroup=zshRedir + \ start=+<\@<!<<-\s*\(["']\)\z(\S\+\)\1+ \ end='^\s*\z1\>' -syn match zshVariable '\<\h\w*\ze+\==' +syn match zshVariable '\<\h\w*' contained + +syn match zshVariableDef '\<\h\w*\ze+\==' " XXX: how safe is this? -syn region zshVariable oneline +syn region zshVariableDef oneline \ start='\$\@<!\<\h\w*\[' end='\]\ze+\==' \ contains=@zshSubst @@ -87,7 +100,7 @@ if s:zsh_syntax_variables =~ 'all' syn match zshDeref '\$[=^~]*[#+]*\h\w*\>' else - syn match zshDeref transparent '\$[=^~]*[#+]*\h\w*\>' + syn match zshDeref transparent contains=NONE '\$[=^~]*[#+]*\h\w*\>' endif syn match zshCommands '\%(^\|\s\)[.:]\ze\s' @@ -119,6 +132,7 @@ syn match zshNumber '[+-]\=\d\+#[-+]\=\w\+\>' syn match zshNumber '[+-]\=\d\+\.\d\+\>' +" TODO: $[...] is the same as $((...)), so add that as well. syn cluster zshSubst contains=zshSubst,zshOldSubst,zshMathSubst syn region zshSubst matchgroup=zshSubstDelim transparent \ start='\$(' skip='\\)' end=')' contains=TOP @@ -131,10 +145,14 @@ syn region zshBrackets contained transparent start='{' skip='\\}' \ end='}' syn region zshSubst matchgroup=zshSubstDelim start='\${' skip='\\}' - \ end='}' contains=@zshSubst,zshBrackets,zshQuoted + \ end='}' contains=@zshSubst,zshBrackets,zshQuoted,zshString syn region zshOldSubst matchgroup=zshSubstDelim start=+`+ skip=+\\`+ \ end=+`+ contains=TOP,zshOldSubst +syn sync minlines=50 +syn sync match zshHereDocSync grouphere NONE '<<-\=\s*\%(\\\=\S\+\|\(["']\)\S\+\1\)' +syn sync match zshHereDocEndSync groupthere NONE '^\s*EO\a\+\>' + hi def link zshTodo Todo hi def link zshComment Comment hi def link zshPreProc PreProc @@ -163,6 +181,7 @@ hi def link zshRedir None endif hi def link zshVariable None +hi def link zshVariableDef zshVariable hi def link zshDereferencing PreProc if s:zsh_syntax_variables =~ 'short\|all' hi def link zshShortDeref zshDereferencing