📄 tcl.vim
字号:
" Vim syntax file" Language: TCL/TK" Maintainer: Matt Neumann <mattneu@purpleturtle.com>" (previously Allan Kelly <allan@fruitloaf.co.uk>)" Original: Robin Becker <robin@jessikat.demon.co.uk>" Version: 5.1(synched), 1998 June 29"" Keywords TODO: format clock click anchor" For version 5.x: Clear all syntax items" For version 6.x: Quit when a syntax file was already loadedif version < 600 syntax clearelseif exists("b:current_syntax") finishendif" A bunch of useful keywordssyn keyword tclStatement proc global return lindexsyn keyword tclStatement llength lappend lreplace lrange list concat incrsyn keyword tclStatement upvar setsyn keyword tclLabel case defaultsyn keyword tclConditional if then else elseif switchsyn keyword tclRepeat while for foreach break continuesyn keyword tcltkSwitch contained insert create polygon fill outline tag" WIDGETS" commands associated with widgetssyn keyword tcltkWidgetSwitch contained background highlightbackground insertontime cgetsyn keyword tcltkWidgetSwitch contained selectborderwidth borderwidth highlightcolor insertwidthsyn keyword tcltkWidgetSwitch contained selectforeground cursor highlightthickness padx setgridsyn keyword tcltkWidgetSwitch contained exportselection insertbackground pady takefocussyn keyword tcltkWidgetSwitch contained font insertborderwidth relief xscrollcommandsyn keyword tcltkWidgetSwitch contained foreground insertofftime selectbackground yscrollcommandsyn keyword tcltkWidgetSwitch contained height spacing1 spacing2 spacing3syn keyword tcltkWidgetSwitch contained state tabs width wrap" buttonsyn keyword tcltkWidgetSwitch contained command default" canvassyn keyword tcltkWidgetSwitch contained closeenough confine scrollregion xscrollincrement yscrollincrement orient" checkbutton, radiobuttonsyn keyword tcltkWidgetSwitch contained indicatoron offvalue onvalue selectcolor selectimage state variable" entry, framesyn keyword tcltkWidgetSwitch contained show class colormap container visual" listbox, menusyn keyword tcltkWidgetSwitch contained selectmode postcommand selectcolor tearoff tearoffcommand title type" menubutton, messagesyn keyword tcltkWidgetSwitch contained direction aspect justify" scalesyn keyword tcltkWidgetSwitch contained bigincrement digits from length resolution showvalue sliderlength sliderrelief tickinterval to" scrollbarsyn keyword tcltkWidgetSwitch contained activerelief elementborderwidth" imagesyn keyword tcltkWidgetSwitch contained delete names types create" variable referencesyn match tclVarRef "$\a[a-zA-Z0-9_.]*"syn match tclVarRef "${\a[a-zA-Z0-9_.]*}"" menu, mane addsyn keyword tcltkWidgetSwitch contained active end last none cascade checkbutton command radiobutton separatorsyn keyword tcltkWidgetSwitch contained activebackground actveforeground accelerator background bitmap columnbreaksyn keyword tcltkWidgetSwitch contained font foreground hidemargin image indicatoron label menu offvalue onvaluesyn keyword tcltkWidgetSwitch contained selectcolor selectimage state underline value variablesyn keyword tcltkWidgetSwitch contained add clone configure delete entrycget entryconfigure index insert invokesyn keyword tcltkWidgetSwitch contained post postcascade type unpost yposition activate"syn keyword tcltkWidgetSwitch contained"syn match tcltkWidgetSwitch containedsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<button\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<scale\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<canvas\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<checkbutton\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<entry\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<frame\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<image\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<listbox\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<menubutton\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<message\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<radiobutton\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\<scrollbar\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRef" These words are dual purpose." match switchessyn match tcltkWidgetSwitch contained "-text"hs=s+1syn match tcltkWidgetSwitch contained "-menu"hs=s+1syn match tcltkWidgetSwitch contained "-label"hs=s+1" match commands - 2 lines for pretty match."variable" Special case - If a number follows a variable region, it must be at the end of" the pattern, by definition. Therefore, (1) either include a number as the region" end and exclude tclNumber from the contains list, or (2) make variable" keepend. As (1) would put variable out of step with everything else, use (2).syn region tcltkCommand matchgroup=tcltkCommandColor start="^\<variable\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tclString,tclNumber,tclVarRef,tcltkCommandsyn region tcltkCommand matchgroup=tcltkCommandColor start="\s\<variable\>\|\[\<variable\>"hs=s+1 matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tclString,tclNumber,tclVarRef,tcltkCommand" menusyn region tcltkWidget matchgroup=tcltkWidgetColor start="^\<menu\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\s\<menu\>\|\[\<menu\>"hs=s+1 matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRef" labelsyn region tcltkWidget matchgroup=tcltkWidgetColor start="^\<label\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRefsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\s\<label\>\|\[\<label\>"hs=s+1 matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRef" textsyn region tcltkWidget matchgroup=tcltkWidgetColor start="^\<text\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidget,tcltkWidgetSwitch,tcltkSwitch,tclNumber,tclVarRef,tclStringsyn region tcltkWidget matchgroup=tcltkWidgetColor start="\s\<text\>\|\[\<text\>"hs=s+1 matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidget,tcltkWidgetSwitch,tclString,tcltkSwitch,tclNumber,tclVarRef" This isn't contained (I don't think) so it's OK to just associate with the Color group." TODO: This could be wrong.syn keyword tcltkWidgetColor toplevelsyn region tcltkPackConf matchgroup=tcltkPackConfColor start="\<configure\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tcltkPackConfSwitch,tclNumber,tclVarRef keependsyn region tcltkPackConf matchgroup=tcltkPackConfColor start="\<cget\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkWidgetSwitch,tclString,tcltkSwitch,tcltkPackConfSwitch,tclNumber,tclVarRef" NAMESPACE" commands associated with namespacesyn keyword tcltkNamespaceSwitch contained children code current delete evalsyn keyword tcltkNamespaceSwitch contained export forget import inscope originsyn keyword tcltkNamespaceSwitch contained parent qualifiers tail which command variablesyn region tcltkCommand matchgroup=tcltkCommandColor start="\<namespace\>" matchgroup=NONE skip="^\s*$" end="{\|}\|]\|\"\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkNamespaceSwitch" EXPR" commands associated with exprsyn keyword tcltkMaths contained acos cos hypot sinhsyn keyword tcltkMaths contained asin cosh log sqrtsyn keyword tcltkMaths contained atan exp log10 tansyn keyword tcltkMaths contained atan2 floor pow tanhsyn keyword tcltkMaths contained ceil fmod sinsyn region tcltkCommand matchgroup=tcltkCommandColor start="\<expr\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkMaths,tclNumber,tclVarRef,tclString,tcltlWidgetSwitch,tcltkCommand,tcltkPackConf" formatsyn region tcltkCommand matchgroup=tcltkCommandColor start="\<format\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"me=e-1 contains=tclLineContinue,tcltkMaths,tclNumber,tclVarRef,tclString,tcltlWidgetSwitch,tcltkCommand,tcltkPackConf" PACK" commands associated with packsyn keyword tcltkPackSwitch contained forget info propogate slavessyn keyword tcltkPackConfSwitch contained after anchor before expand fill in ipadx ipady padx pady sidesyn region tcltkCommand matchgroup=tcltkCommandColor start="\<pack\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkPackSwitch,tcltkPackConf,tcltkPackConfSwitch,tclNumber,tclVarRef,tclString,tcltkCommand keepend" STRING" commands associated with stringsyn keyword tcltkStringSwitch contained compare first index last length match range tolower toupper trim trimleft trimright wordstart wordendsyn region tcltkCommand matchgroup=tcltkCommandColor start="\<string\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkStringSwitch,tclNumber,tclVarRef,tclString,tcltkCommand" ARRAY" commands associated with arraysyn keyword tcltkArraySwitch contained anymore donesearch exists get names nextelement size startsearch set" match from command name to ] or EOLsyn region tcltkCommand matchgroup=tcltkCommandColor start="\<array\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkArraySwitch,tclNumber,tclVarRef,tclString,tcltkCommand" LSORT" switches for lsortsyn keyword tcltkLsortSwitch contained ascii dictionary integer real command increasing decreasing index" match from command name to ] or EOLsyn region tcltkCommand matchgroup=tcltkCommandColor start="\<lsort\>" matchgroup=NONE skip="^\s*$" end="]\|[^\\]*\s*$"he=e-1 contains=tclLineContinue,tcltkLsortSwitch,tclNumber,tclVarRef,tclString,tcltkCommandsyn keyword tclTodo contained TODO" String and Character contstants" Highlight special characters (those which have a backslash) differentlysyn match tclSpecial contained "\\\d\d\d\=\|\\."" A string needs the skip argument as it may legitimately contain \"." Match at start of linesyn region tclString start=+^"+ end=+"+ contains=tclSpecial skip=+\\\\\|\\"+"Match all other legal strings.syn region tclString start=+[^\\]"+ms=s+1 end=+"+ contains=tclSpecial skip=+\\\\\|\\"+syn match tclLineContinue "\\\s*$""integer number, or floating point number without a dot and with "f".syn case ignoresyn match tclNumber "\<\d\+\(u\=l\=\|lu\|f\)\>""floating point number, with dot, optional exponentsyn match tclNumber "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>""floating point number, starting with a dot, optional exponentsyn match tclNumber "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>""floating point number, without dot, with exponentsyn match tclNumber "\<\d\+e[-+]\=\d\+[fl]\=\>""hex numbersyn match tclNumber "0x[0-9a-f]\+\(u\=l\=\|lu\)\>""syn match tclIdentifier "\<[a-z_][a-z0-9_]*\>"syn case matchsyn region tclComment start="^\s*\#" end="$" contains=tclTodosyn region tclComment start=/;\s*\#/hs=s+1 end="$" contains=tclTodo"syn sync ccomment tclComment" Define the default highlighting." For version 5.7 and earlier: only when not done already" For version 5.8 and later: only when an item doesn't have highlighting yetif version >= 508 || !exists("did_tcl_syntax_inits") if version < 508 let did_tcl_syntax_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink tcltkSwitch Special HiLink tclLabel Label HiLink tclConditional Conditional HiLink tclRepeat Repeat HiLink tclNumber Number HiLink tclError Error HiLink tclStatement Statement "HiLink tclStatementColor Statement HiLink tclString String HiLink tclComment Comment HiLink tclSpecial Special HiLink tclTodo Todo " Below here are the commands and their options. HiLink tcltkCommandColor Statement HiLink tcltkWidgetColor Structure HiLink tclLineContinue WarningMsg HiLink tcltkStringSwitch Special HiLink tcltkArraySwitch Special HiLink tcltkLsortSwitch Special HiLink tcltkPackSwitch Special HiLink tcltkPackConfSwitch Special HiLink tcltkMaths Special HiLink tcltkNamespaceSwitch Special HiLink tcltkWidgetSwitch Special HiLink tcltkPackConfColor Identifier "HiLink tcltkLsort Statement HiLink tclVarRef Identifier delcommand HiLinkendiflet b:current_syntax = "tcl"" vim: ts=8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -