diff options
author | Bram Moolenaar <Bram@vim.org> | 2008-06-24 20:39:31 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2008-06-24 20:39:31 +0000 |
commit | a7241f5f19fd0865ce697939c347a8c88fb507d5 (patch) | |
tree | e1f1c07fe74094539286be048cc3306f6aedb0bc /runtime/syntax | |
parent | f233048a129fa7a3b89e064078435181d6421da5 (diff) |
updated for version 7.2a
Diffstat (limited to 'runtime/syntax')
-rw-r--r-- | runtime/syntax/cmusrc.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/gp.vim | 6 | ||||
-rw-r--r-- | runtime/syntax/manual.vim | 9 | ||||
-rw-r--r-- | runtime/syntax/msmessages.vim | 135 | ||||
-rw-r--r-- | runtime/syntax/netrw.vim | 66 | ||||
-rw-r--r-- | runtime/syntax/pdf.vim | 73 | ||||
-rw-r--r-- | runtime/syntax/ruby.vim | 2 | ||||
-rw-r--r-- | runtime/syntax/scheme.vim | 5 | ||||
-rw-r--r-- | runtime/syntax/tcsh.vim | 219 |
9 files changed, 410 insertions, 109 deletions
diff --git a/runtime/syntax/cmusrc.vim b/runtime/syntax/cmusrc.vim index 3e84751a9b..e36a69c698 100644 --- a/runtime/syntax/cmusrc.vim +++ b/runtime/syntax/cmusrc.vim @@ -1,6 +1,6 @@ " Vim syntax file " Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-07-22 +" Latest Revision: 2007-06-17 if exists("b:current_syntax") finish @@ -9,7 +9,7 @@ endif let s:cpo_save = &cpo set cpo&vim -setlocal iskeyword=@,48-57,_,- +setlocal iskeyword+=- syn keyword cmusrcTodo contained TODO FIXME XXX NOTE diff --git a/runtime/syntax/gp.vim b/runtime/syntax/gp.vim index 4be13440d5..2793aa4ed8 100644 --- a/runtime/syntax/gp.vim +++ b/runtime/syntax/gp.vim @@ -1,7 +1,7 @@ " Vim syntax file -" Language: gp (version 2.2) +" Language: gp (version 2.4) " Maintainer: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr> -" Last change: 2006 Apr 12 +" Last change: 2007 Oct 1 " URL: http://pari.math.u-bordeaux.fr if version < 600 @@ -15,7 +15,7 @@ syntax keyword gpStatement break return next syntax keyword gpConditional if syntax keyword gpRepeat until while for fordiv forprime forstep forvec " storage class -syntax keyword gpScope local global +syntax keyword gpScope my local global " defaults syntax keyword gpInterfaceKey colors compatible datadir debug debugfiles syntax keyword gpInterfaceKey debugmem echo factor_add_primes format help diff --git a/runtime/syntax/manual.vim b/runtime/syntax/manual.vim index 5ac045f603..5ea373180a 100644 --- a/runtime/syntax/manual.vim +++ b/runtime/syntax/manual.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2001 Jun 04 +" Last Change: 2008 Jan 26 " This file is used for ":syntax manual". " It installs the Syntax autocommands, but no the FileType autocommands. @@ -17,9 +17,12 @@ endif let syntax_manual = 1 " Remove the connection between FileType and Syntax autocommands. -silent! au! syntaxset FileType +if exists('#syntaxset') + au! syntaxset FileType +endif " If the GUI is already running, may still need to install the FileType menu. -if has("gui_running") && !exists("did_install_syntax_menu") +" Don't do it when the 'M' flag is included in 'guioptions'. +if has("menu") && has("gui_running") && !exists("did_install_syntax_menu") && &guioptions !~# 'M' source $VIMRUNTIME/menu.vim endif diff --git a/runtime/syntax/msmessages.vim b/runtime/syntax/msmessages.vim new file mode 100644 index 0000000000..60588571c9 --- /dev/null +++ b/runtime/syntax/msmessages.vim @@ -0,0 +1,135 @@ +" Vim syntax file +" Language: MS Message Text files (*.mc) +" Maintainer: Kevin Locke <kwl7@cornell.edu> +" Last Change: 2008 April 09 +" Location: http://kevinlocke.name/programs/vim/syntax/msmessages.vim + +" See format description at <http://msdn2.microsoft.com/en-us/library/aa385646.aspx> +" This file is based on the rc.vim and c.vim + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" Common MS Messages keywords +syn case ignore +syn keyword msmessagesIdentifier MessageIdTypedef +syn keyword msmessagesIdentifier SeverityNames +syn keyword msmessagesIdentifier FacilityNames +syn keyword msmessagesIdentifier LanguageNames +syn keyword msmessagesIdentifier OutputBase + +syn keyword msmessagesIdentifier MessageId +syn keyword msmessagesIdentifier Severity +syn keyword msmessagesIdentifier Facility +syn keyword msmessagesIdentifier OutputBase + +syn match msmessagesIdentifier /\<SymbolicName\>/ nextgroup=msmessagesIdentEq skipwhite +syn match msmessagesIdentEq transparent /=/ nextgroup=msmessagesIdentDef skipwhite contained +syn match msmessagesIdentDef display /\w\+/ contained +" Note: The Language keyword is highlighted as part of an msmessagesLangEntry + +" Set value +syn case match +syn region msmessagesSet start="(" end=")" transparent fold contains=msmessagesName keepend +syn match msmessagesName /\w\+/ nextgroup=msmessagesSetEquals skipwhite contained +syn match msmessagesSetEquals /=/ display transparent nextgroup=msmessagesNumVal skipwhite contained +syn match msmessagesNumVal display transparent "\<\d\|\.\d" contains=msmessagesNumber,msmessagesFloat,msmessagesOctalError,msmessagesOctal nextgroup=msmessagesValSep +syn match msmessagesValSep /:/ display nextgroup=msmessagesNameDef contained +syn match msmessagesNameDef /\w\+/ display contained + + +" Comments are converted to C source (by removing leading ;) +" So we highlight the comments as C +syn include @msmessagesC syntax/c.vim +unlet b:current_syntax +syn region msmessagesCComment matchgroup=msmessagesComment start=/;/ end=/$/ contains=@msmessagesC keepend + +" String and Character constants +" Highlight special characters (those which have a escape) differently +syn case ignore +syn region msmessagesLangEntry start=/\<Language\>\s*=\s*\S\+\s*$/hs=e+1 end=/^\./ contains=msmessagesFormat,msmessagesLangEntryEnd,msmessagesLanguage keepend +syn match msmessagesLanguage /\<Language\(\s*=\)\@=/ contained +syn match msmessagesLangEntryEnd display /^\./ contained +syn case match +syn match msmessagesFormat display /%[1-9]\d\?\(![-+0 #]*\d*\(\.\d\+\)\?\(h\|l\|ll\|I\|I32\|I64\)\?[aAcCdeEfgGinopsSuxX]!\)\?/ contained +syn match msmessagesFormat display /%[0.%\\br]/ contained +syn match msmessagesFormat display /%!\(\s\)\@=/ contained + +" Integer number, or floating point number without a dot and with "f". +" Copied from c.vim +syn case ignore +"(long) integer +syn match msmessagesNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>" +"hex number +syn match msmessagesNumber display contained "\<0x\x\+\(u\=l\{0,2}\|ll\=u\)\>" +" Flag the first zero of an octal number as something special +syn match msmessagesOctal display contained "\<0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=msmessagesOctalZero +syn match msmessagesOctalZero display contained "\<0" +" flag an octal number with wrong digits +syn match msmessagesOctalError display contained "\<0\o*[89]\d*" +syn match msmessagesFloat display contained "\d\+f" +"floating point number, with dot, optional exponent +syn match msmessagesFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=" +"floating point number, starting with a dot, optional exponent +syn match msmessagesFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" +"floating point number, without dot, with exponent +syn match msmessagesFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>" +"hexadecimal floating point number, optional leading digits, with dot, with exponent +syn match msmessagesFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>" +"hexadecimal floating point number, with leading digits, optional dot, with exponent +syn match msmessagesFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>" + +" Types (used in MessageIdTypedef statement) +syn case match +syn keyword msmessagesType int long short char +syn keyword msmessagesType signed unsigned +syn keyword msmessagesType size_t ssize_t sig_atomic_t +syn keyword msmessagesType int8_t int16_t int32_t int64_t +syn keyword msmessagesType uint8_t uint16_t uint32_t uint64_t +syn keyword msmessagesType int_least8_t int_least16_t int_least32_t int_least64_t +syn keyword msmessagesType uint_least8_t uint_least16_t uint_least32_t uint_least64_t +syn keyword msmessagesType int_fast8_t int_fast16_t int_fast32_t int_fast64_t +syn keyword msmessagesType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t +syn keyword msmessagesType intptr_t uintptr_t +syn keyword msmessagesType intmax_t uintmax_t +" Add some Windows datatypes that will be common in msmessages files +syn keyword msmessagesType BYTE CHAR SHORT SIZE_T SSIZE_T TBYTE TCHAR UCHAR USHORT +syn keyword msmessagesType DWORD DWORDLONG DWORD32 DWORD64 +syn keyword msmessagesType INT INT32 INT64 UINT UINT32 UINT64 +syn keyword msmessagesType LONG LONGLONG LONG32 LONG64 +syn keyword msmessagesType ULONG ULONGLONG ULONG32 ULONG64 + +" Sync to language entries, since they should be most common +syn sync match msmessagesLangSync grouphere msmessagesLangEntry "\<Language\s*=" +syn sync match msmessagesLangEndSync grouphere NONE "^\." + +" Define the default highlighting. +hi def link msmessagesNumber Number +hi def link msmessagesOctal Number +hi def link msmessagesFloat Float +hi def link msmessagesOctalError msmessagesError +hi def link msmessagesSetError msmessagesError +hi def link msmessagesError Error +hi def link msmessagesLangEntry String +hi def link msmessagesLangEntryEnd Special +hi def link msmessagesComment Comment +hi def link msmessagesFormat msmessagesSpecial +hi def link msmessagesSpecial SpecialChar + +hi def link msmessagesType Type +hi def link msmessagesIdentifier Identifier +hi def link msmessagesLanguage msmessagesIdentifier +hi def link msmessagesName msmessagesIdentifier +hi def link msmessagesNameDef Macro +hi def link msmessagesIdentDef Macro +hi def link msmessagesValSep Special +hi def link msmessagesNameErr Error + +let b:current_syntax = "msmessages" + +" vim: ts=8 diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim index e2baac8887..62dab3feb6 100644 --- a/runtime/syntax/netrw.vim +++ b/runtime/syntax/netrw.vim @@ -1,7 +1,7 @@ " Language : Netrw Remote-Directory Listing Syntax " Maintainer : Charles E. Campbell, Jr. -" Last change: Nov 27, 2006 -" Version : 9 +" Last change: Feb 06, 2008 +" Version : 12 " --------------------------------------------------------------------- " Syntax Clearing: {{{1 @@ -13,40 +13,59 @@ endif " --------------------------------------------------------------------- " Directory List Syntax Highlighting: {{{1 -syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion +syn cluster NetrwGroup contains=netrwHide,netrwSortBy,netrwSortSeq,netrwQuickHelp,netrwVersion,netrwCopyTgt +syn cluster NetrwTreeGroup contains=netrwDir,netrwSymLink,netrwExe -syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify -syn match netrwDir "\.\{1,2}/" contains=netrwClassify -syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify -syn match netrwDir "^\S*/" contains=netrwClassify -syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" contains=netrwDateSep skipwhite nextgroup=netrwTime -syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify -syn match netrwExe "\%(\S\+ \)*\S\+\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify,netrwTreeIgnore -syn match netrwTreeIgnore contained "^\%(| \)*" +syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify +syn match netrwDir "\.\{1,2}/" contains=netrwClassify +syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify +syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" contains=netrwDateSep skipwhite nextgroup=netrwTime +syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify +syn match netrwExe "\%(\S\+ \)*\S\+\*\ze\%(\s\{2,}\|$\)" contains=netrwClassify +syn match netrwTreeBar "^\%(| \)*" contains=netrwTreeBarSpace nextgroup=@netrwTreeGroup +syn match netrwTreeBarSpace " " contained syn match netrwClassify "[*=|@/]\ze\%(\s\{2,}\|$\)" contained syn match netrwDateSep "/" contained -syn match netrwTime "\d\{1,2}:\d\{2}:\d\{2}" contained contains=netrwTimeSep +syn match netrwTime "\d\{1,2}:\d\{2}:\d\{2}" contained contains=netrwTimeSep syn match netrwTimeSep ":" -syn match netrwComment '".*\%(\t\|$\)' contains=@NetrwGroup +syn match netrwComment '".*\%(\t\|$\)' contains=@NetrwGroup syn match netrwHide '^"\s*\(Hid\|Show\)ing:' skipwhite nextgroup=netrwHidePat syn match netrwSlash "/" contained syn match netrwHidePat "[^,]\+" contained skipwhite nextgroup=netrwHideSep syn match netrwHideSep "," contained transparent skipwhite nextgroup=netrwHidePat syn match netrwSortBy "Sorted by" contained transparent skipwhite nextgroup=netrwList syn match netrwSortSeq "Sort sequence:" contained transparent skipwhite nextgroup=netrwList -syn match netrwList ".*$" contained contains=netrwComma +syn match netrwCopyTgt "Copy/Move Tgt:" contained transparent skipwhite nextgroup=netrwList +syn match netrwList ".*$" contained contains=netrwComma syn match netrwComma "," contained -syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd keepend contained +syn region netrwQuickHelp matchgroup=Comment start="Quick Help:\s\+" end="$" contains=netrwHelpCmd keepend contained syn match netrwHelpCmd "\S\ze:" contained skipwhite nextgroup=netrwCmdSep syn match netrwCmdSep ":" contained nextgroup=netrwCmdNote syn match netrwCmdNote ".\{-}\ze " contained syn match netrwVersion "(netrw.*)" contained +" ----------------------------- +" Special filetype highlighting {{{1 +" ----------------------------- +if exists("g:netrw_special_syntax") && netrw_special_syntax + syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar + syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar + syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar + syn match netrwHdr "\(\S\+ \)*\S\+\.h\>" contains=netrwTreeBar + syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar + syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar + syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar + syn match netrwTags "\<tags\>" contains=netrwTreeBar + syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar + syn match netrwTilde "\(\S\+ \)*\S\+\~\>" contains=netrwTreeBar + syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar +endif + " --------------------------------------------------------------------- " Highlighting Links: {{{1 -if !exists("did_drchip_dbg_syntax") +if !exists("did_drchip_netrwlist_syntax") let did_drchip_netrwlist_syntax= 1 hi link netrwClassify Function hi link netrwCmdSep Delimiter @@ -56,13 +75,26 @@ if !exists("did_drchip_dbg_syntax") hi link netrwHidePat Statement hi link netrwList Statement hi link netrwVersion Identifier - hi link netrwSymLink Special + hi link netrwSymLink Question hi link netrwExe PreProc hi link netrwDateSep Delimiter + hi link netrwTreeBar Special hi link netrwTimeSep netrwDateSep hi link netrwComma netrwComment hi link netrwHide netrwComment + hi link netrwMarkFile Identifier + + " special syntax highlighting (see :he g:netrw_special_syntax) + hi link netrwBak NonText + hi link netrwCompress Folded + hi link netrwData DiffChange + hi link netrwLib DiffChange + hi link netrwMakefile DiffChange + hi link netrwObj Folded + hi link netrwTilde Folded + hi link netrwTmp Folded + hi link netrwTags Folded endif " Current Syntax: {{{1 diff --git a/runtime/syntax/pdf.vim b/runtime/syntax/pdf.vim new file mode 100644 index 0000000000..86d80daa6a --- /dev/null +++ b/runtime/syntax/pdf.vim @@ -0,0 +1,73 @@ +" Vim syntax file +" Language: PDF +" Maintainer: Tim Pope <vimNOSPAM@tpope.info> +" Last Change: 2007 Dec 16 + +if exists("b:current_syntax") + finish +endif + +if !exists("main_syntax") + let main_syntax = 'pdf' +endif + +syn include @pdfXML syntax/xml.vim + +syn case match + +syn cluster pdfObjects contains=pdfBoolean,pdfConstant,pdfNumber,pdfFloat,pdfName,pdfHexString,pdfString,pdfArray,pdfHash,pdfReference,pdfComment +syn keyword pdfBoolean true false contained +syn keyword pdfConstant null contained +syn match pdfNumber "[+-]\=\<\d\+\>" +syn match pdfFloat "[+-]\=\<\%(\d\+\.\|\d*\.\d\+\)\>" contained + +syn match pdfNameError "#\X\|#\x\X\|#00" contained containedin=pdfName +syn match pdfSpecialChar "#\x\x" contained containedin=pdfName +syn match pdfName "/[^[:space:]\[\](){}<>/]*" contained +syn match pdfHexError "[^[:space:][:xdigit:]<>]" contained +"syn match pdfHexString "<\s*\x[^<>]*\x\s*>" contained contains=pdfHexError +"syn match pdfHexString "<\s*\x\=\s*>" contained +syn region pdfHexString matchgroup=pdfDelimiter start="<<\@!" end=">" contained contains=pdfHexError +syn match pdfStringError "\\." contained containedin=pdfString +syn match pdfSpecialChar "\\\%(\o\{1,3\}\|[nrtbf()\\]\)" contained containedin=pdfString +syn region pdfString matchgroup=pdfDelimiter start="\\\@<!(" end="\\\@<!)" contains=pdfString + +syn region pdfArray matchgroup=pdfOperator start="\[" end="\]" contains=@pdfObjects contained +syn region pdfHash matchgroup=pdfOperator start="<<" end=">>" contains=@pdfObjects contained +syn match pdfReference "\<\d\+\s\+\d\+\s\+R\>" +"syn keyword pdfOperator R contained containedin=pdfReference + +syn region pdfObject matchgroup=pdfType start="\<obj\>" end="\<endobj\>" contains=@pdfObjects +syn region pdfObject matchgroup=pdfType start="\<obj\r\=\n" end="\<endobj\>" contains=@pdfObjects fold + +" Do these twice. The ones with only newlines are foldable +syn region pdfStream matchgroup=pdfType start="\<stream\r\=\n" end="endstream\s*\%(\r\|\n\|\r\n\)" contained containedin=pdfObject +syn region pdfXMLStream matchgroup=pdfType start="\<stream\r\=\n\_s*\%(<?\)\@=" end="endstream\s*\%(\r\|\n\|\r\n\)" contained containedin=pdfObject contains=@pdfXML +syn region pdfStream matchgroup=pdfType start="\<stream\n" end="endstream\s*\%(\r\|\n\|\r\n\)" contained containedin=pdfObject fold +syn region pdfXMLStream matchgroup=pdfType start="\<stream\n\_s*\%(<?\)\@=" end="endstream\s*\%(\r\|\n\|\r\n\)" contained containedin=pdfObject contains=@pdfXML fold + +syn region pdfPreProc start="\<xref\%(\r\|\n\|\r\n\)" end="^trailer\%(\r\|\n\|\r\n\)" skipwhite skipempty nextgroup=pdfHash contains=pdfNumber fold +syn keyword pdfPreProc startxref +syn match pdfComment "%.*\%(\r\|\n\)" contains=pdfPreProc +syn match pdfPreProc "^%\%(%EOF\|PDF-\d\.\d\)\(\r\|\n\)" + +hi def link pdfOperator Operator +hi def link pdfNumber Number +hi def link pdfFloat Float +hi def link pdfBoolean Boolean +hi def link pdfConstant Constant +hi def link pdfName Identifier +hi def link pdfNameError pdfStringError +hi def link pdfHexString pdfString +hi def link pdfHexError pdfStringError +hi def link pdfString String +hi def link pdfStringError Error +hi def link pdfSpecialChar SpecialChar +hi def link pdfDelimiter Delimiter +hi def link pdfType Type +hi def link pdfReference Tag +hi def link pdfStream NonText +hi def link pdfPreProc PreProc +hi def link pdfComment Comment + +let b:current_syntax = "pdf" diff --git a/runtime/syntax/ruby.vim b/runtime/syntax/ruby.vim index 42a88f4758..f68d7f4dac 100644 --- a/runtime/syntax/ruby.vim +++ b/runtime/syntax/ruby.vim @@ -321,4 +321,4 @@ hi def link rubySpaceError rubyError let b:current_syntax = "ruby" -" vim: nowrap sw=2 sts=2 ts=8 noet ff=unix: +" vim: nowrap sw=2 sts=2 ts=8 noet : diff --git a/runtime/syntax/scheme.vim b/runtime/syntax/scheme.vim index 93d4187f3f..6f6927f67b 100644 --- a/runtime/syntax/scheme.vim +++ b/runtime/syntax/scheme.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: Scheme (R5RS) -" Last Change: Nov 28, 2004 +" Last Change: 2007 Jun 16 " Maintainer: Sergey Khorev <sergey.khorev@gmail.com> " Original author: Dirk van Deun <dirk@igwe.vub.ac.be> @@ -265,6 +265,9 @@ if exists("b:is_chicken") || exists("is_chicken") syn region ChickenC matchgroup=schemeComment start=+#>%+ end=+<#+ contains=@ChickenC endif + " suggested by Alex Queiroz + syn match schemeExtSyntax oneline "#![-a-z!$%&*/:<=>?^_~0-9+.@#%]\+" + syn region schemeString start=+#<#\s*\z(.*\)+ end=+^\z1$+ endif " Synchronization and the wrapping up... diff --git a/runtime/syntax/tcsh.vim b/runtime/syntax/tcsh.vim index 83649a7515..94c4181c3a 100644 --- a/runtime/syntax/tcsh.vim +++ b/runtime/syntax/tcsh.vim @@ -1,7 +1,6 @@ -" Vim syntax file -" Language: C-shell (tcsh) -" Maintainer: Gautam Iyer <gi1242@users.sourceforge.net> -" Last Modified: Thu 16 Nov 2006 01:07:04 PM PST +" tcsh.vim: Vim syntax file for tcsh scripts +" Maintainer: Gautam Iyer <gi1242@users.sourceforge.net> +" Modified: Sat 16 Jun 2007 04:52:12 PM PDT " " Description: We break up each statement into a "command" and an "end" part. " All groups are either a "command" or part of the "end" of a statement (ie @@ -13,64 +12,118 @@ " causes history to come up as a keyword, which we want to avoid. " Quit when a syntax file was already loaded -if exists("b:current_syntax") +if exists('b:current_syntax') finish endif +let s:oldcpo = &cpo +set cpo&vim " Line continuation is used + +setlocal iskeyword+=- + syn case match " ----- Clusters ----- syn cluster tcshModifiers contains=tcshModifier,tcshModifierError syn cluster tcshQuoteList contains=tcshDQuote,tcshSQuote,tcshBQuote -syn cluster tcshStatementEnds contains=@tcshQuoteList,tcshComment,tcshUsrVar,TcshArgv,tcshSubst,tcshRedir,tcshMeta,tcshHereDoc,tcshSpecial,tcshArguement -syn cluster tcshStatements contains=tcshBuiltins,tcshCommands,tcshSet,tcshSetEnv,tcshAlias,tcshIf,tcshWhile +syn cluster tcshStatementEnds contains=@tcshQuoteList,tcshComment,@tcshVarList,tcshRedir,tcshMeta,tcshHereDoc,tcshSpecial,tcshArguement +syn cluster tcshStatements contains=tcshBuiltin,tcshCommands,tcshIf,tcshWhile syn cluster tcshVarList contains=tcshUsrVar,tcshArgv,tcshSubst +syn cluster tcshConditions contains=tcshCmdSubst,tcshParenExpr,tcshOperator,tcshNumber,@tcshVarList + +" ----- Errors ----- +" Define first, so can be easily overridden. +syn match tcshError contained '\v\S.+' " ----- Statements ----- " Tcsh commands: Any filename / modifiable variable (must be first!) syn match tcshCommands '\v[a-zA-Z0-9\\./_$:-]+' contains=tcshSpecial,tcshUsrVar,tcshArgv,tcshVarError nextgroup=tcshStatementEnd -" Builtin commands except (un)set(env), (un)alias, if, while, else -syn keyword tcshBuiltins nextgroup=tcshStatementEnd alloc bg bindkey break breaksw builtins bye case cd chdir complete continue default dirs echo echotc end endif endsw eval exec exit fg filetest foreach getspath getxvers glob goto hashstat history hup inlib jobs kill limit log login logout ls ls-F migrate newgrp nice nohup notify onintr popd printenv pushd rehash repeat rootnode sched setpath setspath settc setty setxvers shift source stop suspend switch telltc time umask uncomplete unhash universe unlimit ver wait warp watchlog where which +" Builtin commands except those treated specially. Currently (un)set(env), +" (un)alias, if, while, else, bindkey +syn keyword tcshBuiltin nextgroup=tcshStatementEnd alloc bg break breaksw builtins bye case cd chdir complete continue default dirs echo echotc end endif endsw eval exec exit fg filetest foreach getspath getxvers glob goto hashstat history hup inlib jobs kill limit log login logout ls ls-F migrate newgrp nice nohup notify onintr popd printenv pushd rehash repeat rootnode sched setpath setspath settc setty setxvers shift source stop suspend switch telltc time umask uncomplete unhash universe unlimit ver wait warp watchlog where which -" StatementEnd is anything after a builtin / command till the lexical end of a +" StatementEnd is anything after a built-in / command till the lexical end of a " statement (;, |, ||, |&, && or end of line) -syn region tcshStatementEnd transparent contained matchgroup=tcshBuiltins start='' end='\v\\@<!(;|\|[|&]?|\&\&|$)' contains=@tcshStatementEnds +syn region tcshStatementEnd transparent contained matchgroup=tcshBuiltin start='' end='\v\\@<!(;|\|[|&]?|\&\&|$)' contains=@tcshStatementEnds " set expressions (Contains shell variables) syn keyword tcshShellVar contained afsuser ampm argv autocorrect autoexpand autolist autologout backslash_quote catalog cdpath color colorcat command complete continue continue_args correct cwd dextract dirsfile dirstack dspmbyte dunique echo echo_style edit ellipsis fignore filec gid group histchars histdup histfile histlit history home ignoreeof implicitcd inputmode killdup killring listflags listjobs listlinks listmax listmaxrows loginsh logout mail matchbeep nobeep noclobber noding noglob nokanji nonomatch nostat notify oid owd path printexitvalue prompt prompt2 prompt3 promptchars pushdtohome pushdsilent recexact recognize_only_executables rmstar rprompt savedirs savehist sched shell shlvl status symlinks tcsh term time tperiod tty uid user verbose version visiblebell watch who wordchars -syn keyword tcshSet nextgroup=tcshSetEnd set unset -syn region tcshSetEnd contained transparent matchgroup=tcshBuiltins start='' skip="\\$" end="$\|;" contains=tcshShellVar,@tcshStatementEnds +syn keyword tcshBuiltin nextgroup=tcshSetEnd set unset +syn region tcshSetEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$\|;' contains=tcshShellVar,@tcshStatementEnds -" setenv expressions (Contains enviorenment variables) +" setenv expressions (Contains environment variables) syn keyword tcshEnvVar contained AFSUSER COLUMNS DISPLAY EDITOR GROUP HOME HOST HOSTTYPE HPATH LANG LC_CTYPE LINES LS_COLORS MACHTYPE NOREBIND OSTYPE PATH PWD REMOTEHOST SHLVL SYSTYPE TERM TERMCAP USER VENDOR VISUAL -syn keyword tcshSetEnv nextgroup=tcshEnvEnd setenv unsetenv -syn region tcshEnvEnd contained transparent matchgroup=tcshBuiltins start='' skip="\\$" end="$\|;" contains=tcshEnvVar,@tcshStatementEnds +syn keyword tcshBuiltin nextgroup=tcshEnvEnd setenv unsetenv +syn region tcshEnvEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$\|;' contains=tcshEnvVar,@tcshStatementEnds " alias and unalias (contains special aliases) syn keyword tcshAliases contained beepcmd cwdcmd jobcmd helpcommand periodic precmd postcmd shell -syn keyword tcshAlias nextgroup=tcshAliCmd skipwhite alias unalias +syn keyword tcshBuiltin nextgroup=tcshAliCmd skipwhite alias unalias syn match tcshAliCmd contained nextgroup=tcshAliEnd skipwhite '\v[\w-]+' contains=tcshAliases -syn region tcshAliEnd contained transparent matchgroup=tcshBuiltins start='' skip="\\$" end="$\|;" contains=@tcshStatementEnds +syn region tcshAliEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$\|;' contains=@tcshStatementEnds -" if statements (contains expressions / operators) -syn keyword tcshIf nextgroup=tcshIfEnd if -syn region tcshIfEnd contained matchgroup=tcshBuiltins start='' skip="\\$" end="\v<then>|$" contains=tcshOperator,tcshNumber,@tcshStatementEnds +" if statements +syn keyword tcshIf nextgroup=tcshIfEnd skipwhite if +syn region tcshIfEnd contained start='\S' skip='\\$' matchgroup=tcshBuiltin end='\v<then>|$' contains=@tcshConditions,tcshSpecial,@tcshStatementEnds +syn region tcshIfEnd contained matchgroup=tcshBuiltin contains=@tcshConditions,tcshSpecial start='(' end='\v\)%(\s+then>)?' skipwhite nextgroup=@tcshStatementEnds +syn region tcshIfEnd contained matchgroup=tcshBuiltin contains=tcshCommands,tcshSpecial start='\v\{\s+' end='\v\s+\}%(\s+then>)?' skipwhite nextgroup=@tcshStatementEnds keepend -" else statements (nextgroup if) -syn keyword tcshElse nextgroup=tcshIf skipwhite else +" else statements +syn keyword tcshBuiltin nextgroup=tcshIf skipwhite else " while statements (contains expressions / operators) -syn keyword tcshWhile nextgroup=tcshWhEnd while -syn region tcshWhEnd contained transparent matchgroup=tcshBuiltins start='' skip="\\$" end="\v$" contains=tcshOperator,tcshNumber,@tcshStatementEnds +syn keyword tcshBuiltin nextgroup=@tcshConditions,tcshSpecial skipwhite while + +" Conditions (for if and while) +syn region tcshParenExpr contained contains=@tcshConditions,tcshSpecial matchgroup=tcshBuiltin start='(' end=')' +syn region tcshCmdSubst contained contains=tcshCommands matchgroup=tcshBuiltin start='\v\{\s+' end='\v\s+\}' keepend + +" Bindkey. Internal editor functions +syn keyword tcshBindkeyFuncs contained backward-char backward-delete-char + \ backward-delete-word backward-kill-line backward-word + \ beginning-of-line capitalize-word change-case + \ change-till-end-of-line clear-screen complete-word + \ complete-word-fwd complete-word-back complete-word-raw + \ copy-prev-word copy-region-as-kill dabbrev-expand delete-char + \ delete-char-or-eof delete-char-or-list + \ delete-char-or-list-or-eof delete-word digit digit-argument + \ down-history downcase-word end-of-file end-of-line + \ exchange-point-and-mark expand-glob expand-history expand-line + \ expand-variables forward-char forward-word + \ gosmacs-transpose-chars history-search-backward + \ history-search-forward insert-last-word i-search-fwd + \ i-search-back keyboard-quit kill-line kill-region + \ kill-whole-line list-choices list-choices-raw list-glob + \ list-or-eof load-average magic-space newline normalize-path + \ normalize-command overwrite-mode prefix-meta quoted-insert + \ redisplay run-fg-editor run-help self-insert-command + \ sequence-lead-in set-mark-command spell-word spell-line + \ stuff-char toggle-literal-history transpose-chars + \ transpose-gosling tty-dsusp tty-flush-output tty-sigintr + \ tty-sigquit tty-sigtsusp tty-start-output tty-stop-output + \ undefined-key universal-argument up-history upcase-word + \ vi-beginning-of-next-word vi-add vi-add-at-eol vi-chg-case + \ vi-chg-meta vi-chg-to-eol vi-cmd-mode vi-cmd-mode-complete + \ vi-delprev vi-delmeta vi-endword vi-eword vi-char-back + \ vi-char-fwd vi-charto-back vi-charto-fwd vi-insert + \ vi-insert-at-bol vi-repeat-char-fwd vi-repeat-char-back + \ vi-repeat-search-fwd vi-repeat-search-back vi-replace-char + \ vi-replace-mode vi-search-back vi-search-fwd vi-substitute-char + \ vi-substitute-line vi-word-back vi-word-fwd vi-undo vi-zero + \ which-command yank yank-pop e_copy_to_clipboard + \ e_paste_from_clipboard e_dosify_next e_dosify_prev e_page_up + \ e_page_down +syn keyword tcshBuiltin nextgroup=tcshBindkeyEnd bindkey +syn region tcshBindkeyEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$' contains=@tcshQuoteList,tcshComment,@tcshVarList,tcshMeta,tcshSpecial,tcshArguement,tcshBindkeyFuncs " Expressions start with @. -syn match tcshExprStart "\v\@\s+" nextgroup=tcshExprVar -syn match tcshExprVar contained "\v\h\w*%(\[\d+\])?" contains=tcshShellVar,tcshEnvVar nextgroup=tcshExprOp -syn match tcshExprOp contained "++\|--" -syn match tcshExprOp contained "\v\s*\=" nextgroup=tcshExprEnd -syn match tcshExprEnd contained "\v.*$"hs=e+1 contains=tcshOperator,tcshNumber,@tcshVarList -syn match tcshExprEnd contained "\v.{-};"hs=e contains=tcshOperator,tcshNumber,@tcshVarList +syn match tcshExprStart '\v\@\s+' nextgroup=tcshExprVar +syn match tcshExprVar contained '\v\h\w*%(\[\d+\])?' contains=tcshShellVar,tcshEnvVar nextgroup=tcshExprOp +syn match tcshExprOp contained '++\|--' +syn match tcshExprOp contained '\v\s*\=' nextgroup=tcshExprEnd +syn match tcshExprEnd contained '\v.*$'hs=e+1 contains=@tcshConditions +syn match tcshExprEnd contained '\v.{-};'hs=e contains=@tcshConditions " ----- Comments: ----- syn match tcshComment '#\s.*' contains=tcshTodo,tcshCommentTi,@Spell @@ -85,12 +138,12 @@ syn match tcshTodo contained '\v\c<todo>' " want VIM to assume that no backslash quote constructs exist. " Backquotes are treated as commands, and are not contained in anything -if(exists("tcsh_backslash_quote") && tcsh_backslash_quote == 0) - syn region tcshSQuote keepend contained start="\v\\@<!'" end="'" contains=@Spell +if(exists('tcsh_backslash_quote') && tcsh_backslash_quote == 0) + syn region tcshSQuote keepend contained start="\v\\@<!'" end="'" syn region tcshDQuote keepend contained start='\v\\@<!"' end='"' contains=@tcshVarList,tcshSpecial,@Spell syn region tcshBQuote keepend start='\v\\@<!`' end='`' contains=@tcshStatements else - syn region tcshSQuote contained start="\v\\@<!'" skip="\v\\\\|\\'" end="'" contains=@Spell + syn region tcshSQuote contained start="\v\\@<!'" skip="\v\\\\|\\'" end="'" syn region tcshDQuote contained start='\v\\@<!"' end='"' contains=@tcshVarList,tcshSpecial,@Spell syn region tcshBQuote keepend matchgroup=tcshBQuoteGrp start='\v\\@<!`' skip='\v\\\\|\\`' end='`' contains=@tcshStatements endif @@ -101,17 +154,17 @@ endif syn match tcshVarError '\v\$\S*' contained " Modifiable Variables without {}. -syn match tcshUsrVar contained "\v\$\h\w*%(\[\d+%(-\d+)?\])?" nextgroup=@tcshModifiers contains=tcshShellVar,tcshEnvVar -syn match tcshArgv contained "\v\$%(\d+|\*)" nextgroup=@tcshModifiers +syn match tcshUsrVar contained '\v\$\h\w*%(\[\d+%(-\d+)?\])?' nextgroup=@tcshModifiers contains=tcshShellVar,tcshEnvVar +syn match tcshArgv contained '\v\$%(\d+|\*)' nextgroup=@tcshModifiers " Modifiable Variables with {}. -syn match tcshUsrVar contained "\v\$\{\h\w*%(\[\d+%(-\d+)?\])?%(:\S*)?\}" contains=@tcshModifiers,tcshShellVar,tcshEnvVar -syn match tcshArgv contained "\v\$\{%(\d+|\*)%(:\S*)?\}" contains=@tcshModifiers +syn match tcshUsrVar contained '\v\$\{\h\w*%(\[\d+%(-\d+)?\])?%(:\S*)?\}' contains=@tcshModifiers,tcshShellVar,tcshEnvVar +syn match tcshArgv contained '\v\$\{%(\d+|\*)%(:\S*)?\}' contains=@tcshModifiers -" UnModifiable Substitutions. Order is important here. -syn match tcshSubst contained "\v\$[?#$!_<]" nextgroup=tcshModifierError -syn match tcshSubst contained "\v\$[%#?]%(\h\w*|\d+)" nextgroup=tcshModifierError contains=tcshShellVar,tcshEnvVar -syn match tcshSubst contained "\v\$\{[%#?]%(\h\w*|\d+)%(:\S*)?\}" contains=tcshModifierError contains=tcshShellVar,tcshEnvVar +" Un-modifiable Substitutions. Order is important here. +syn match tcshSubst contained '\v\$[?#$!_<]' nextgroup=tcshModifierError +syn match tcshSubst contained '\v\$[%#?]%(\h\w*|\d+)' nextgroup=tcshModifierError contains=tcshShellVar,tcshEnvVar +syn match tcshSubst contained '\v\$\{[%#?]%(\h\w*|\d+)%(:\S*)?\}' contains=tcshModifierError contains=tcshShellVar,tcshEnvVar " Variable Name Expansion Modifiers (order important) syn match tcshModifierError contained '\v:\S*' @@ -119,61 +172,60 @@ syn match tcshModifier contained '\v:[ag]?[htreuls&qx]' nextgroup=@tcshModifier " ----- Operators / Specials ----- " Standard redirects (except <<) [<, >, >>, >>&, >>!, >>&!] -syn match tcshRedir contained "\v\<|\>\>?\&?!?" +syn match tcshRedir contained '\v\<|\>\>?\&?!?' -" Metachars -syn match tcshMeta contained "\v[]{}*?[]" +" Meta-chars +syn match tcshMeta contained '\v[]{}*?[]' -" Here Documents (<<) -syn region tcshHereDoc contained matchgroup=tcshRedir start="\v\<\<\s*\z(\h\w*)" end="^\z1$" contains=@tcshVarList,tcshSpecial -syn region tcshHereDoc contained matchgroup=tcshRedir start="\v\<\<\s*'\z(\h\w*)'" start='\v\<\<\s*"\z(\h\w*)"$' start="\v\<\<\s*\\\z(\h\w*)$" end="^\z1$" +" Here documents (<<) +syn region tcshHereDoc contained matchgroup=tcshShellVar start='\v\<\<\s*\z(\h\w*)' end='^\z1$' contains=@tcshVarList,tcshSpecial +syn region tcshHereDoc contained matchgroup=tcshShellVar start="\v\<\<\s*'\z(\h\w*)'" start='\v\<\<\s*"\z(\h\w*)"$' start='\v\<\<\s*\\\z(\h\w*)$' end='^\z1$' " Operators -syn match tcshOperator contained "&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|\~\|||\|!\|%\|&\|+\|-\|/\|<\|>\||" -syn match tcshOperator contained "[(){}]" +syn match tcshOperator contained '&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|\~\|||\|!\|%\|&\|+\|-\|/\|<\|>\||' +"syn match tcshOperator contained '[(){}]' " Numbers -syn match tcshNumber contained "\v<-?\d+>" +syn match tcshNumber contained '\v<-?\d+>' -" Arguements -syn match tcshArguement contained "\v\s@<=-(\w|-)*" +" Arguments +syn match tcshArguement contained '\v\s@<=-(\w|-)*' -" Special charectors -syn match tcshSpecial contained "\v\\@<!\\(\d{3}|.)" +" Special characters. \xxx, or backslashed characters. +"syn match tcshSpecial contained '\v\\@<!\\(\d{3}|.)' +syn match tcshSpecial contained '\v\\%([0-7]{3}|.)' -" ----- Syncronising ----- -if exists("tcsh_minlines") - exec "syn sync minlines=" . tcsh_minlines +" ----- Synchronising ----- +if exists('tcsh_minlines') + exec 'syn sync minlines=' . tcsh_minlines else - syn sync minlines=15 " Except 'here' documents, nothing is long + syn sync minlines=100 " Some completions can be quite long endif " Define highlighting of syntax groups -hi def link tcshBuiltins statement -hi def link tcshShellVar preproc +hi def link tcshError Error +hi def link tcshBuiltin Statement +hi def link tcshShellVar Preproc hi def link tcshEnvVar tcshShellVar hi def link tcshAliases tcshShellVar -hi def link tcshAliCmd identifier -hi def link tcshCommands identifier -hi def link tcshSet tcshBuiltins -hi def link tcshSetEnv tcshBuiltins -hi def link tcshAlias tcshBuiltins -hi def link tcshIf tcshBuiltins -hi def link tcshElse tcshBuiltins -hi def link tcshWhile tcshBuiltins -hi def link tcshExprStart tcshBuiltins +hi def link tcshAliCmd Identifier +hi def link tcshCommands Identifier +hi def link tcshIf tcshBuiltin +hi def link tcshWhile tcshBuiltin +hi def link tcshBindkeyFuncs Function +hi def link tcshExprStart tcshBuiltin hi def link tcshExprVar tcshUsrVar hi def link tcshExprOp tcshOperator hi def link tcshExprEnd tcshOperator -hi def link tcshComment comment -hi def link tcshCommentTi preproc +hi def link tcshComment Comment +hi def link tcshCommentTi Preproc hi def link tcshSharpBang tcshCommentTi -hi def link tcshTodo tod |