Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Software

Journal karniv0re's Journal: ColdFusion Syntax File for Vim

cf.vim in the syntax directory. Contains a bunch (not all) CF 8 tags, and a bunch of our custom tags.

" Vim syntax file
" Language: ColdFusion
" Maintainer: Toby Woodwark (toby.woodwark+vim@gmail.com)
" Last Change: 2005 Nov 25
" Filenames: *.cfc *.cfm
" Version: Macromedia ColdFusion MX 7
" Usage: Note that ColdFusion has its own comment syntax
" i.e. <!--- --->

" For version 5.x, clear all syntax items.
" For version 6.x+, quit if a syntax file is already loaded.
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif

" Use all the stuff from the HTML syntax file.
" TODO remove this; CFML is not a superset of HTML
if version < 600
source <sfile>:p:h/html.vim
else
runtime! syntax/html.vim
endif

syn sync fromstart
syn sync maxlines=200
syn case ignore

" Scopes and keywords.
syn keyword cfScope contained cgi cffile request caller this thistag cfcatch variables application server session client form url attributes arguments
syn keyword cfBool contained yes no true false

" Operator strings.
" Not exhaustive, since there are longhand equivalents.
syn keyword cfOperator contained xor eqv and or lt le lte gt ge gte eq neq not is mod contains
syn match cfOperatorMatch contained "[\+\-\*\/\\\^\&][\+\-\*\/\\\^\&]\@!"
syn cluster cfOperatorCluster contains=cfOperator,cfOperatorMatch

" Tag names.

syn keyword cfTagName contained cf_SSI cf_UPEmail_Addr cf_UPFile2Query cf_ValidEMail cf_app_outage cf_clientTimeout
syn keyword cfTagName contained cf_clusterRun cf_compress cf_excel cf_network_connection cf_qoq cf_query_size
syn keyword cfTagName contained cf_runOnAll cf_upAreas cf_upBrowser cf_upCOED cf_upChart cf_upChartSeries
syn keyword cfTagName contained cf_upContent cf_upDepartments cf_upDirectory cf_upFile cf_upGraphViz cf_upHTML2PDF
syn keyword cfTagName contained cf_upImageRotate cf_upJMSQueueReceiver cf_upJMSQueueSender cf_upJMSTopicSender
syn keyword cfTagName contained cf_upJMSTopicsReceiver cf_upLDAP cf_upLoad cf_upLocations cf_upMach_Name cf_upMergePDF
syn keyword cfTagName contained cf_upPieChart cf_upPrintTable cf_upProperCase cf_upRemoveDupes cf_upSMSTAD
syn keyword cfTagName contained cf_upStock cf_upTivoli cf_upXMF cf_upZip cf_upiSiloX cfx_long2Image cfx_upBarcode
syn keyword cfTagName contained cfx_upEAM cfx_upExecute cfx_upMeter cfx_upPrintService
syn keyword cfTagName contained cfabort cfapplet cfapplication cfajaximport cfajaxproxy cfargument cfassociate cfbreak cfcache
syn keyword cfTagName contained cfcalendar cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection
syn keyword cfTagName contained cfcomponent cfcontent cfcookie cfdefaultcase cfdirectory cfdiv cfdocument
syn keyword cfTagName contained cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror cfexecute
syn keyword cfTagName contained cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid
syn keyword cfTagName contained cfgridcolumn cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage
syn keyword cfTagName contained cfimport cfinclude cfindex cfinput cfinsert cfinvoke cfinvokeargument cflayout cflayoutarea
syn keyword cfTagName contained cfldap cflocation cflock cflog cflogin cfloginuser cflogout cfloop cfmail
syn keyword cfTagName contained cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate cfobject cfobjectcache
syn keyword cfTagName contained cfoutput cfparam cfpdf cfpdfform cfpdfparam cfpdfsubform cfpod cfpop cfprocessingdirective
syn keyword cfTagName contained cfprocparam cfprocresult cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow
syn keyword cfTagName contained cfreturn cfsavecontent cfschedule cfscript cfsearch cfselect cfset cfsetting
syn keyword cfTagName contained cfsilent cfslider cfstoredproc cfswitch cftable cftextarea cfthread cfthrow cftimer
syn keyword cfTagName contained cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx cfxml

" Tag parameters.
syn keyword cfArg contained abort accept access accessible action addNewLine addr_lookup addtoken agentname
syn keyword cfArg contained alias align alternateRowColor appendkey appletsource application applicationTLA
syn keyword cfArg contained applicationtimeout applicationtoken appname archive argumentcollection arguments
syn keyword cfArg contained asciiextensionlist attachmentpath attribute_list attributecollection attributes
syn keyword cfArg contained autoTrim autowidth backgroundcolor backgroundvisible basetag bcc bgcolor bind bindingname
syn keyword cfArg contained blockfactor body bold border branch cachedafter cachedwithin casesensitive categories
syn keyword cfArg contained category categorytree cc cfsqltype charset chartStyle chartTitle chartheight chartwidth
syn keyword cfArg contained checked class clientmanagement clientstorage cluster codebase colheaderalign colheaderbold
syn keyword cfArg contained colheaderfont colheaderfontsize colheaderitalic colheaders colheadertextcolor collection
syn keyword cfArg contained colorlist colspacing columnList columns combineFormat command completepath component
syn keyword cfArg contained compressedFilename compressionType condition connection connectionFactory contentid
syn keyword cfArg contained context contextbytes contexthighlightbegin contexthighlightend contextpassages
syn keyword cfArg contained cookiedomain criteria custom1 custom2 custom3 custom4 data dataSymbol dataSymbolSize dataalign
syn keyword cfArg contained databackgroundcolor datacollection datalabelstyle datalist datasource date daynames dbname
syn keyword cfArg contained dbserver dbtype dbvarname debug default definition_file definition_string degreeEnd degreeStart
syn keyword cfArg contained degrees delstatic_File delete deletebutton deletefile delim delimiter delimiters depth3d
syn keyword cfArg contained description destination destinationDirectory detail directory disabled display displayname disposition
syn keyword cfArg contained dn domain email emailTo empID enablecab enablecfoutputonly enabled encoded encryption enctype
syn keyword cfArg contained endZone1 endZone2 endZonen enddate endrange endrow endtime entry environment errorcode event_class
syn keyword cfArg contained event_source exception existing expand expires expireurl expression extendedinfo extends
syn keyword cfArg contained extensions external failifexists failto file fileContents fileExtension fileField fileList
syn keyword cfArg contained fileName filefield filename files filter firstName firstdayofweek firstname firstrowasheaders folder
syn keyword cfArg contained font fontFace fontbold fontembed fontitalic fontsize foregroundcolor format formfields formula
syn keyword cfArg contained freezePaneHeight from function generateuniquefilenames getasbinary grid griddataalign
syn keyword cfArg contained gridlines groovecolor group groupcasesensitive header headerTitles headeralign headerbold
syn keyword cfArg contained headerfont headerfontsize headeritalic headerlines headertextcolor height highlighthref
syn keyword cfArg contained hint href hrefkey hscroll hspace htmloutput htmltable id idletimeout imageDir imageFile
syn keyword cfArg contained imageHeight imageResize imageWidth img imgopen imgstyle includeHeadWhite index inline input
syn keyword cfArg contained inseconds insert insertbutton interval ipAddress isolation italic item itemcolumn ixl_file key
syn keyword cfArg contained keyonly label labelColumn labelformat labelsList lableAngle lableList language lastName lastname
syn keyword cfArg contained lata lineWidth list listgroups locale localfile log loginstorage lookandfeel macroTick mailerid
syn keyword cfArg contained mailto majorTick marginbottom marginleft marginright margintop markersize markerstyle mask
syn keyword cfArg contained maxRecords maxlength maxrows message messageType messagenumber method mimeattach mimetype minorTick
syn keyword cfArg contained mode modifytype monthnames mouseOver multipart multiple name nameConflict namecomplict nameconflict
syn keyword cfArg contained namespace new newFile newFileName newImageSize new_content newdirectory noDataMessage notsupported
syn keyword cfArg contained null numberformat numofseries numofzones object omit onchange onclick onerror onkeydown onkeyup onload
syn keyword cfArg contained onmousedown onmouseup onreset onsubmit onvalidate operation oracleServerName oracleServerPort
syn keyword cfArg contained oracleServerSid orderby orientation orig_content outage_end outage_start output outputFile outputPath
syn keyword cfArg contained output_file outputfile overwrite ownerpassword pageencoding pageheight pagetype pagewidth paintstyle
syn keyword cfArg contained param_1 param_2 param_3 param_4 param_5 parent passive passthrough password path pathToIni pattern
syn keyword cfArg contained pdf_filename pdf_options pdf_path permissions picturebar pieslicestyle port porttypename prefix
syn keyword cfArg contained preloader preservedata previouscriteria procedure processName propFile protocol provider providerdsn
syn keyword cfArg contained proxybypass proxypassword proxyport proxyserver proxyuser publish query queryParams query_name queryasroot
syn keyword cfArg contained queryposition radius range rebind recurse redirect referral refreshlabel remotefile replyTo replyto
syn keyword cfArg contained report requestor requesttimeout required reset resolveurl result resultsPerPage resultset retryTimes
syn keyword cfArg contained retrycount returnasbinary returncode returntype returnvariable role roles rowheaderalign rowheaderbold
syn keyword cfArg contained rowheaderfont rowheaderfontsize rowheaderitalic rowheaders rowheadertextcolor rowheaderwidth
syn keyword cfArg contained rowheight scale scaleFrom scaleFrom2 scaleStep scaleStep2 scaleTo scaleTo2 scalefrom scaleto scope
syn keyword cfArg contained scriptprotect scriptsrc secure securitycontext select selectcolor selected selecteddate selectedindex
syn keyword cfArg contained selectmode selector separator seriesLabel seriesType seriescolor serieslabel seriesplacement server
syn keyword cfArg contained serverTLA server_name serviceName serviceport serviceportname sessionmanagement sessiontimeout
syn keyword cfArg contained setclientcookies setcookie setdomaincookies severity show3d showDataLabel showDataSymbol showFreezePane
syn keyword cfArg contained showGridLines showLegend showPages showRecordCount showborder showdebugoutput showerror showlegend
syn keyword cfArg contained showmarkers showxgridlines showygridlines size skin skipList sort sortascendingbutton sortcontrol
syn keyword cfArg contained sortdescendingbutton sortxaxis source sourceDirectory specialType spoolenable sql sql src start startGroup
syn keyword cfArg contained startRow startZone1 startZone2 startZonen startdate startrange startrow starttime static_fileName static_path
syn keyword cfArg contained status statuscode statustext step stoponerror string style subject suggestions sumColumns sumColumnsEachPage
syn keyword cfArg contained sumColumnsOnly sumColumnsTitle sumRows sumRowsTitle suppresswhitespace swapXY tablename tableowner
syn keyword cfArg contained tablequalifier taglib target task template text textcolor textqualifier thread throwonerror throwonfailure
syn keyword cfArg contained throwontimeout time timeOut timeOut timeout timespan tipbgcolor tipstyle title titleAlign to tooltip
syn keyword cfArg contained top toplevelvariable transfermode type typeList uid unit url urlparams urlpath useRicola2 user userID
syn keyword cfArg contained useragent userid username userpassword usetimezoneinfo validate validateat value valueColumn valueList
syn keyword cfArg contained valuecolumn values valuesdelimiter valuesdisplay var variable vertical view virtual visible
syn keyword cfArg contained vscroll vspace warning_end warning_start webservice width wmode wraptext wsdlfile x xAxisTitle xaxistitle
syn keyword cfArg contained xaxistype xmlMsgBody xoffset y yAxis yAxisTitle yaxistitle yaxistype yoffset

" ColdFusion Functions.
syn keyword cfFunctionName contained Abs ajaxOnLoad ajaxLink GetFunctionList Max ACos GetGatewayHelper Mid AddSOAPRequestHeader
syn keyword cfFunctionName contained GetHttpRequestData Min isJSON serializeJSON deSerializeJSON AddSOAPResponseHeader GetHttpTimeString
syn keyword cfFunctionName contained ArrayAppend GetLocale Month ArrayAvg GetLocaleDisplayName MonthAsString Minute
syn keyword cfFunctionName contained ArrayClear GetMetaData Now ArrayDeleteAt GetMetricData NumberFormat
syn keyword cfFunctionName contained ArrayInsertAt GetPageContext ParagraphFormat ArrayIsEmpty GetProfileSections
syn keyword cfFunctionName contained ParseDateTime ArrayLen GetProfileString Pi ArrayMax GetSOAPRequest
syn keyword cfFunctionName contained PreserveSingleQuotes ArrayMin GetSOAPRequestHeader Quarter ArrayNew
syn keyword cfFunctionName contained GetSOAPResponse QueryAddColumn ArrayPrepend GetSOAPResponseHeader QueryAddRow
syn keyword cfFunctionName contained ArrayResize GetTempDirectory QueryNew ArraySet GetTempFile QuerySetCell
syn keyword cfFunctionName contained ArraySort GetTickCount QuotedValueList ArraySum GetTimeZoneInfo Rand ArraySwap
syn keyword cfFunctionName contained GetToken Randomize ArrayToList Hash RandRange Asc Hour REFind ASin
syn keyword cfFunctionName contained HTMLCodeFormat REFindNoCase Atn HTMLEditFormat ReleaseComObject BinaryDecode
syn keyword cfFunctionName contained IIf RemoveChars BinaryEncode IncrementValue RepeatString BitAnd InputBaseN
syn keyword cfFunctionName contained Replace BitMaskClear Insert ReplaceList BitMaskRead Int ReplaceNoCase
syn keyword cfFunctionName contained BitMaskSet IsArray REReplace BitNot IsBinary REReplaceNoCase BitOr IsBoolean
syn keyword cfFunctionName contained Reverse BitSHLN IsCustomFunction Right BitSHRN IsDate RJustify BitXor
syn keyword cfFunctionName contained IsDebugMode Round Ceiling IsDefined RTrim CharsetDecode IsLeapYear Second
syn keyword cfFunctionName contained CharsetEncode IsNumeric SendGatewayMessage Chr IsNumericDate SetEncoding
syn keyword cfFunctionName contained CJustify IsObject SetLocale Compare IsQuery SetProfileString CompareNoCase
syn keyword cfFunctionName contained IsSimpleValue SetVariable Cos IsSOAPRequest Sgn CreateDate IsStruct Sin
syn keyword cfFunctionName contained CreateDateTime IsUserInRole SpanExcluding CreateObject IsValid SpanIncluding
syn keyword cfFunctionName contained CreateODBCDate IsWDDX Sqr CreateODBCDateTime IsXML StripCR CreateODBCTime
syn keyword cfFunctionName contained IsXmlAttribute StructAppend CreateTime IsXmlDoc StructClear CreateTimeSpan
syn keyword cfFunctionName contained IsXmlElem StructCopy CreateUUID IsXmlNode StructCount DateAdd IsXmlRoot
syn keyword cfFunctionName contained StructDelete DateCompare JavaCast StructFind DateConvert JSStringFormat
syn keyword cfFunctionName contained StructFindKey DateDiff LCase StructFindValue DateFormat Left StructGet
syn keyword cfFunctionName contained DatePart Len StructInsert Day ListAppend StructIsEmpty DayOfWeek
syn keyword cfFunctionName contained ListChangeDelims StructKeyArray DayOfWeekAsString ListContains StructKeyExists
syn keyword cfFunctionName contained DayOfYear ListContainsNoCase StructKeyList DaysInMonth ListDeleteAt StructNew
syn keyword cfFunctionName contained DaysInYear ListFind StructSort DE ListFindNoCase StructUpdate DecimalFormat
syn keyword cfFunctionName contained ListFirst Tan DecrementValue ListGetAt TimeFormat Decrypt ListInsertAt
syn keyword cfFunctionName contained ToBase64 DeleteClientVariable ListLast ToBinary DirectoryExists ListLen
syn keyword cfFunctionName contained ToScript DollarFormat ListPrepend ToString Duplicate ListQualify Trim Encrypt
syn keyword cfFunctionName contained ListRest UCase Evaluate ListSetAt URLDecode Exp ListSort URLEncodedFormat
syn keyword cfFunctionName contained ExpandPath ListToArray URLSessionFormat FileExists ListValueCount Val Find
syn keyword cfFunctionName contained ListValueCountNoCase ValueList FindNoCase LJustify Week FindOneOf Log Wrap
syn keyword cfFunctionName contained FirstDayOfMonth Log10 WriteOutput Fix LSCurrencyFormat XmlChildPos FormatBaseN
syn keyword cfFunctionName contained LSDateFormat XmlElemNew GetTempDirectory LSEuroCurrencyFormat XmlFormat
syn keyword cfFunctionName contained GetAuthUser LSIsCurrency XmlGetNodeType GetBaseTagData LSIsDate XmlNew
syn keyword cfFunctionName contained GetBaseTagList LSIsNumeric XmlParse GetBaseTemplatePath LSNumberFormat
syn keyword cfFunctionName contained XmlSearch GetClientVariablesList LSParseCurrency XmlTransform
syn keyword cfFunctionName contained GetCurrentTemplatePath LSParseDateTime XmlValidate GetDirectoryFromPath
syn keyword cfFunctionName contained LSParseEuroCurrency Year GetEncoding LSParseNumber YesNoFormat GetException
syn keyword cfFunctionName contained LSTimeFormat GetFileFromPath LTrim

syn cluster htmlTagNameCluster add=cfTagName
syn cluster htmlArgCluster add=cfArg,cfHashRegion,cfScope
syn cluster htmlPreproc add=cfHashRegion

syn cluster cfExpressionCluster contains=cfFunctionName,cfScope,@cfOperatorCluster,cfScriptStringD,cfScriptStringS,cfScriptNumber,cfBool

" Evaluation; skip strings ( this helps with cases like nested IIf() )
syn region cfHashRegion start=+#+ skip=+"[^"]*"\|'[^']*'+ end=+#+ contains=@cfExpressionCluster,cfScriptParenError

" <cfset>, <cfif>, <cfelseif>, <cfreturn> are analogous to hashmarks (implicit evaluation) and has 'var'
syn region cfSetRegion start="<cfset " start="<cfreturn " start="<cfelseif " start="<cfif " end='>' keepend contains=@cfExpressionCluster,cfSetLHSRegion,cfSetTagEnd,cfScriptType
syn region cfSetLHSRegion contained start="<cfreturn" start="<cfelseif" start="<cfif" start="<cfset" end=" " keepend contains=cfTagName,htmlTag
syn match cfSetTagEnd contained '>'

" CF comments: similar to SGML comments
syn region cfComment start='<!---' end='--->' keepend contains=cfCommentTodo
syn keyword cfCommentTodo contained TODO FIXME XXX TBD WTF

" CFscript
syn match cfScriptLineComment contained "\/\/.*$" contains=cfCommentTodo
syn region cfScriptComment contained start="/\*" end="\*/" contains=cfCommentTodo
" in CF, quotes are escaped by doubling
syn region cfScriptStringD contained start=+"+ skip=+\\\\\|""+ end=+"+ extend contains=@htmlPreproc,cfHashRegion
syn region cfScriptStringS contained start=+'+ skip=+\\\\\|''+ end=+'+ extend contains=@htmlPreproc,cfHashRegion
syn match cfScriptNumber contained "-\=\<\d\+L\=\>"
syn keyword cfScriptConditional contained if else
syn keyword cfScriptRepeat contained while for in
syn keyword cfScriptBranch contained break switch case try catch continue
syn keyword cfScriptFunction contained function
syn keyword cfScriptType contained var
syn match cfScriptBraces contained "[{}]"
syn keyword cfScriptStatement contained return

syn cluster cfScriptCluster contains=cfScriptParen,cfScriptLineComment,cfScriptComment,cfScriptStringD,cfScriptStringS,cfScriptFunction,cfScriptNumber,cfScriptRegexpString,cfScriptBoolean,cfScriptBraces,cfHashRegion,cfFunctionName,cfScope,@cfOperatorCluster,cfScriptConditional,cfScriptRepeat,cfScriptBranch,cfScriptType,@cfExpressionCluster,cfScriptStatement

" Errors caused by wrong parenthesis; skip strings
syn region cfScriptParen contained transparent skip=+"[^"]*"\|'[^']*'+ start=+(+ end=+)+ contains=@cfScriptCluster
syn match cfScrParenError contained +)+

syn region cfscriptBlock matchgroup=NONE start="<cfscript>" end="<\/cfscript>"me=s-1 keepend contains=@cfScriptCluster,cfscriptTag,cfScrParenError
syn region cfscriptTag contained start='<cfscript' end='>' keepend contains=cfTagName,htmlTag

" Define the default highlighting.
if version >= 508 || !exists("did_cf_syn_inits")
if version < 508
let did_cf_syn_inits = 1
command -nargs=+ HiLink hi link <args>
else
command -nargs=+ HiLink hi def link <args>
endif

HiLink cfTagName Statement
HiLink cfArg Type
HiLink cfFunctionName Function
HiLink cfHashRegion PreProc
HiLink cfComment Comment
HiLink cfCommentTodo Todo
HiLink cfOperator Operator
HiLink cfOperatorMatch Operator
HiLink cfScope Title
HiLink cfBool Constant

HiLink cfscriptBlock Special
HiLink cfscriptTag htmlTag
HiLink cfSetRegion PreProc
HiLink cfSetLHSRegion htmlTag
HiLink cfSetTagEnd htmlTag

HiLink cfScriptLineComment Comment
HiLink cfScriptComment Comment
HiLink cfScriptStringS String
HiLink cfScriptStringD String
HiLink cfScriptNumber cfScriptValue
HiLink cfScriptConditional Conditional
HiLink cfScriptRepeat Repeat
HiLink cfScriptBranch Conditional
HiLink cfScriptType Type
HiLink cfScriptStatement Statement
HiLink cfScriptBraces Function
HiLink cfScriptFunction Function
HiLink cfScriptError Error
HiLink cfScrParenError cfScriptError

delcommand HiLink
endif

let b:current_syntax = "cf"

" vim: ts=8 sw=2

After you've created that, add this line to filetype.vim:

" Cold Fusion
au BufNewFile,BufRead *.cfm,*.cfi,*.cfc setf cf

This discussion has been archived. No new comments can be posted.

ColdFusion Syntax File for Vim

Comments Filter:

"Paul Lynde to block..." -- a contestant on "Hollywood Squares"

Working...