annotate runtime/syntax/tcsh.vim @ 18486:9d887cad7315

Added tag v8.1.2237 for changeset 63ee3c2b140fe1b4801389872a8e47aec19d028b
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Oct 2019 20:00:04 +0100
parents 7bc41231fbc7
children 9c221ad9634a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
1 " tcsh.vim: Vim syntax file for tcsh scripts
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
2 " Maintainer: Gautam Iyer <gi1242@gmail.com>
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
3 " Modified: Thu 17 Dec 2009 06:05:07 PM EST
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Description: We break up each statement into a "command" and an "end" part.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " All groups are either a "command" or part of the "end" of a statement (ie
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " everything after the "command"). This is because blindly highlighting tcsh
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " statements as keywords caused way too many false positives. Eg:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 "
775
f04f56979d84 updated for version 7.0227
vimboss
parents: 376
diff changeset
10 " set history=200
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " causes history to come up as a keyword, which we want to avoid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " Quit when a syntax file was already loaded
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
15 if exists('b:current_syntax')
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
19 let s:oldcpo = &cpo
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
20 set cpo&vim " Line continuation is used
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
21
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
22 setlocal iskeyword+=-
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
23
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 syn case match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " ----- Clusters -----
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 syn cluster tcshModifiers contains=tcshModifier,tcshModifierError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 syn cluster tcshQuoteList contains=tcshDQuote,tcshSQuote,tcshBQuote
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
29 syn cluster tcshStatementEnds contains=@tcshQuoteList,tcshComment,@tcshVarList,tcshRedir,tcshMeta,tcshHereDoc,tcshSpecial,tcshArguement
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
30 syn cluster tcshStatements contains=tcshBuiltin,tcshCommands,tcshIf,tcshWhile
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 syn cluster tcshVarList contains=tcshUsrVar,tcshArgv,tcshSubst
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
32 syn cluster tcshConditions contains=tcshCmdSubst,tcshParenExpr,tcshOperator,tcshNumber,@tcshVarList
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
33
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
34 " ----- Errors -----
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
35 " Define first, so can be easily overridden.
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
36 syn match tcshError contained '\v\S.+'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " ----- Statements -----
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " Tcsh commands: Any filename / modifiable variable (must be first!)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 syn match tcshCommands '\v[a-zA-Z0-9\\./_$:-]+' contains=tcshSpecial,tcshUsrVar,tcshArgv,tcshVarError nextgroup=tcshStatementEnd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
42 " Builtin commands except those treated specially. Currently (un)set(env),
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
43 " (un)alias, if, while, else, bindkey
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
44 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
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
46 " StatementEnd is anything after a built-in / command till the lexical end of a
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 " statement (;, |, ||, |&, && or end of line)
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
48 syn region tcshStatementEnd transparent contained matchgroup=tcshBuiltin start='' end='\v\\@<!(;|\|[|&]?|\&\&|$)' contains=@tcshStatementEnds
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 " set expressions (Contains shell variables)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 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
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
52 syn keyword tcshBuiltin nextgroup=tcshSetEnd set unset
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
53 syn region tcshSetEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$\|;' contains=tcshShellVar,@tcshStatementEnds
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
55 " setenv expressions (Contains environment variables)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 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
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
57 syn keyword tcshBuiltin nextgroup=tcshEnvEnd setenv unsetenv
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
58 syn region tcshEnvEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$\|;' contains=tcshEnvVar,@tcshStatementEnds
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 " alias and unalias (contains special aliases)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 775
diff changeset
61 syn keyword tcshAliases contained beepcmd cwdcmd jobcmd helpcommand periodic precmd postcmd shell
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
62 syn keyword tcshBuiltin nextgroup=tcshAliCmd skipwhite alias unalias
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
63 syn match tcshAliCmd contained nextgroup=tcshAliEnd skipwhite '\v(\w|-)+' contains=tcshAliases
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
64 syn region tcshAliEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$\|;' contains=@tcshStatementEnds
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
66 " if statements
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
67 syn keyword tcshIf nextgroup=tcshIfEnd skipwhite if
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
68 syn region tcshIfEnd contained start='\S' skip='\\$' matchgroup=tcshBuiltin end='\v<then>|$' contains=@tcshConditions,tcshSpecial,@tcshStatementEnds
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
69 syn region tcshIfEnd contained matchgroup=tcshBuiltin contains=@tcshConditions,tcshSpecial start='(' end='\v\)%(\s+then>)?' skipwhite nextgroup=@tcshStatementEnds
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
70 syn region tcshIfEnd contained matchgroup=tcshBuiltin contains=tcshCommands,tcshSpecial start='\v\{\s+' end='\v\s+\}%(\s+then>)?' skipwhite nextgroup=@tcshStatementEnds keepend
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
72 " else statements
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
73 syn keyword tcshBuiltin nextgroup=tcshIf skipwhite else
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 " while statements (contains expressions / operators)
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
76 syn keyword tcshBuiltin nextgroup=@tcshConditions,tcshSpecial skipwhite while
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
77
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
78 " Conditions (for if and while)
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
79 syn region tcshParenExpr contained contains=@tcshConditions,tcshSpecial matchgroup=tcshBuiltin start='(' end=')'
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
80 syn region tcshCmdSubst contained contains=tcshCommands matchgroup=tcshBuiltin start='\v\{\s+' end='\v\s+\}' keepend
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
81
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
82 " Bindkey. Internal editor functions
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
83 syn keyword tcshBindkeyFuncs contained backward-char backward-delete-char
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
84 \ backward-delete-word backward-kill-line backward-word
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
85 \ beginning-of-line capitalize-word change-case
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
86 \ change-till-end-of-line clear-screen complete-word
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
87 \ complete-word-fwd complete-word-back complete-word-raw
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
88 \ copy-prev-word copy-region-as-kill dabbrev-expand delete-char
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
89 \ delete-char-or-eof delete-char-or-list
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
90 \ delete-char-or-list-or-eof delete-word digit digit-argument
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
91 \ down-history downcase-word end-of-file end-of-line
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
92 \ exchange-point-and-mark expand-glob expand-history expand-line
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
93 \ expand-variables forward-char forward-word
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
94 \ gosmacs-transpose-chars history-search-backward
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
95 \ history-search-forward insert-last-word i-search-fwd
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
96 \ i-search-back keyboard-quit kill-line kill-region
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
97 \ kill-whole-line list-choices list-choices-raw list-glob
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
98 \ list-or-eof load-average magic-space newline normalize-path
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
99 \ normalize-command overwrite-mode prefix-meta quoted-insert
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
100 \ redisplay run-fg-editor run-help self-insert-command
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
101 \ sequence-lead-in set-mark-command spell-word spell-line
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
102 \ stuff-char toggle-literal-history transpose-chars
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
103 \ transpose-gosling tty-dsusp tty-flush-output tty-sigintr
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
104 \ tty-sigquit tty-sigtsusp tty-start-output tty-stop-output
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
105 \ undefined-key universal-argument up-history upcase-word
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
106 \ vi-beginning-of-next-word vi-add vi-add-at-eol vi-chg-case
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
107 \ vi-chg-meta vi-chg-to-eol vi-cmd-mode vi-cmd-mode-complete
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
108 \ vi-delprev vi-delmeta vi-endword vi-eword vi-char-back
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
109 \ vi-char-fwd vi-charto-back vi-charto-fwd vi-insert
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
110 \ vi-insert-at-bol vi-repeat-char-fwd vi-repeat-char-back
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
111 \ vi-repeat-search-fwd vi-repeat-search-back vi-replace-char
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
112 \ vi-replace-mode vi-search-back vi-search-fwd vi-substitute-char
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
113 \ vi-substitute-line vi-word-back vi-word-fwd vi-undo vi-zero
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
114 \ which-command yank yank-pop e_copy_to_clipboard
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
115 \ e_paste_from_clipboard e_dosify_next e_dosify_prev e_page_up
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
116 \ e_page_down
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
117 syn keyword tcshBuiltin nextgroup=tcshBindkeyEnd bindkey
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
118 syn region tcshBindkeyEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$' contains=@tcshQuoteList,tcshComment,@tcshVarList,tcshMeta,tcshSpecial,tcshArguement,tcshBindkeyFuncs
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 " Expressions start with @.
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
121 syn match tcshExprStart '\v\@\s+' nextgroup=tcshExprVar
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
122 syn match tcshExprVar contained '\v\h\w*%(\[\d+\])?' contains=tcshShellVar,tcshEnvVar nextgroup=tcshExprOp
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
123 syn match tcshExprOp contained '++\|--'
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
124 syn match tcshExprOp contained '\v\s*\=' nextgroup=tcshExprEnd
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
125 syn match tcshExprEnd contained '\v.*$'hs=e+1 contains=@tcshConditions
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
126 syn match tcshExprEnd contained '\v.{-};'hs=e contains=@tcshConditions
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 " ----- Comments: -----
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 775
diff changeset
129 syn match tcshComment '#\s.*' contains=tcshTodo,tcshCommentTi,@Spell
e63691e7c504 updated for version 7.1a
vimboss
parents: 775
diff changeset
130 syn match tcshComment '\v#($|\S.*)' contains=tcshTodo,tcshCommentTi
e63691e7c504 updated for version 7.1a
vimboss
parents: 775
diff changeset
131 syn match tcshSharpBang '^#! .*$'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 syn match tcshCommentTi contained '\v#\s*\u\w*(\s+\u\w*)*:'hs=s+1 contains=tcshTodo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 syn match tcshTodo contained '\v\c<todo>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 " ----- Strings -----
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 " Tcsh does not allow \" in strings unless the "backslash_quote" shell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 " variable is set. Set the vim variable "tcsh_backslash_quote" to 0 if you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 " want VIM to assume that no backslash quote constructs exist.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 " Backquotes are treated as commands, and are not contained in anything
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
141 if(exists('tcsh_backslash_quote') && tcsh_backslash_quote == 0)
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
142 syn region tcshSQuote keepend contained start="\v\\@<!'" end="'"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 syn region tcshDQuote keepend contained start='\v\\@<!"' end='"' contains=@tcshVarList,tcshSpecial,@Spell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 syn region tcshBQuote keepend start='\v\\@<!`' end='`' contains=@tcshStatements
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 else
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
146 syn region tcshSQuote contained start="\v\\@<!'" skip="\v\\\\|\\'" end="'"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 syn region tcshDQuote contained start='\v\\@<!"' end='"' contains=@tcshVarList,tcshSpecial,@Spell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 syn region tcshBQuote keepend matchgroup=tcshBQuoteGrp start='\v\\@<!`' skip='\v\\\\|\\`' end='`' contains=@tcshStatements
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 " ----- Variables -----
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 " Variable Errors. Must come first! \$ constructs will be flagged by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 " tcshSpecial, so we don't consider them here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 syn match tcshVarError '\v\$\S*' contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 " Modifiable Variables without {}.
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
157 syn match tcshUsrVar contained '\v\$\h\w*%(\[\d+%(-\d+)?\])?' nextgroup=@tcshModifiers contains=tcshShellVar,tcshEnvVar
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
158 syn match tcshArgv contained '\v\$%(\d+|\*)' nextgroup=@tcshModifiers
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 " Modifiable Variables with {}.
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
161 syn match tcshUsrVar contained '\v\$\{\h\w*%(\[\d+%(-\d+)?\])?%(:\S*)?\}' contains=@tcshModifiers,tcshShellVar,tcshEnvVar
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
162 syn match tcshArgv contained '\v\$\{%(\d+|\*)%(:\S*)?\}' contains=@tcshModifiers
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
164 " Un-modifiable Substitutions. Order is important here.
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
165 syn match tcshSubst contained '\v\$[?#$!_<]' nextgroup=tcshModifierError
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
166 syn match tcshSubst contained '\v\$[%#?]%(\h\w*|\d+)' nextgroup=tcshModifierError contains=tcshShellVar,tcshEnvVar
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
167 syn match tcshSubst contained '\v\$\{[%#?]%(\h\w*|\d+)%(:\S*)?\}' contains=tcshModifierError contains=tcshShellVar,tcshEnvVar
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 " Variable Name Expansion Modifiers (order important)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 syn match tcshModifierError contained '\v:\S*'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 syn match tcshModifier contained '\v:[ag]?[htreuls&qx]' nextgroup=@tcshModifiers
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 " ----- Operators / Specials -----
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 " Standard redirects (except <<) [<, >, >>, >>&, >>!, >>&!]
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
175 syn match tcshRedir contained '\v\<|\>\>?\&?!?'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
177 " Meta-chars
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
178 syn match tcshMeta contained '\v[]{}*?[]'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
180 " Here documents (<<)
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
181 syn region tcshHereDoc contained matchgroup=tcshShellVar start='\v\<\<\s*\z(\h\w*)' end='^\z1$' contains=@tcshVarList,tcshSpecial
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
182 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$'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 " Operators
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
185 syn match tcshOperator contained '&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|\~\|||\|!\|%\|&\|+\|-\|/\|<\|>\||'
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
186 "syn match tcshOperator contained '[(){}]'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 " Numbers
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
189 syn match tcshNumber contained '\v<-?\d+>'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
191 " Arguments
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
192 syn match tcshArguement contained '\v\s@<=-(\w|-)*'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
194 " Special characters. \xxx, or backslashed characters.
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
195 "syn match tcshSpecial contained '\v\\@<!\\(\d{3}|.)'
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
196 syn match tcshSpecial contained '\v\\%([0-7]{3}|.)'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
198 " ----- Synchronising -----
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
199 if exists('tcsh_minlines')
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
200 if tcsh_minlines == 'fromstart'
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
201 syn sync fromstart
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
202 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
203 exec 'syn sync minlines=' . tcsh_minlines
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
204 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 else
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
206 syn sync minlines=100 " Some completions can be quite long
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 " Define highlighting of syntax groups
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
210 hi def link tcshError Error
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
211 hi def link tcshBuiltin Statement
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
212 hi def link tcshShellVar Preproc
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 hi def link tcshEnvVar tcshShellVar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 hi def link tcshAliases tcshShellVar
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
215 hi def link tcshAliCmd Identifier
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
216 hi def link tcshCommands Identifier
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
217 hi def link tcshIf tcshBuiltin
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
218 hi def link tcshWhile tcshBuiltin
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
219 hi def link tcshBindkeyFuncs Function
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
220 hi def link tcshExprStart tcshBuiltin
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 hi def link tcshExprVar tcshUsrVar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 hi def link tcshExprOp tcshOperator
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 hi def link tcshExprEnd tcshOperator
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
224 hi def link tcshComment Comment
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
225 hi def link tcshCommentTi Preproc
775
f04f56979d84 updated for version 7.0227
vimboss
parents: 376
diff changeset
226 hi def link tcshSharpBang tcshCommentTi
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
227 hi def link tcshTodo Todo
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
228 hi def link tcshSQuote Constant
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 hi def link tcshDQuote tcshSQuote
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
230 hi def link tcshBQuoteGrp Include
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
231 hi def link tcshVarError Error
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
232 hi def link tcshUsrVar Type
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 hi def link tcshArgv tcshUsrVar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 hi def link tcshSubst tcshUsrVar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 hi def link tcshModifier tcshArguement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 hi def link tcshModifierError tcshVarError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 hi def link tcshMeta tcshSubst
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 hi def link tcshRedir tcshOperator
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 hi def link tcshHereDoc tcshSQuote
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
240 hi def link tcshOperator Operator
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
241 hi def link tcshNumber Number
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
242 hi def link tcshArguement Special
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
243 hi def link tcshSpecial SpecialChar
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244
1619
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
245 let &cpo = s:oldcpo
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
246 unlet s:oldcpo
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
247
b9740fb41986 updated for version 7.2a
vimboss
parents: 1121
diff changeset
248 let b:current_syntax = 'tcsh'