aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax/tcsh.vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/syntax/tcsh.vim')
-rw-r--r--runtime/syntax/tcsh.vim66
1 files changed, 36 insertions, 30 deletions
diff --git a/runtime/syntax/tcsh.vim b/runtime/syntax/tcsh.vim
index 27c6417fd0..6837125129 100644
--- a/runtime/syntax/tcsh.vim
+++ b/runtime/syntax/tcsh.vim
@@ -1,8 +1,9 @@
-" tcsh.vim: Vim syntax file for tcsh scripts
-" Maintainer: Doug Kearns <dougkearns@NoSpam.com> where NoSpam=gmail
-" Author: Gautam Iyer <gi1242+vim@NoSpam.com> where NoSpam=gmail
-" Modified: Sun 26 Sep 2021 12:40:55 PM EDT
-"
+" Vim syntax file
+" Language: tcsh scripts
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Previous Maintainer: Gautam Iyer <gi1242+vim@NoSpam.com> where NoSpam=gmail (Original Author)
+" Last Change: 2021 Oct 15
+
" 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
" everything after the "command"). This is because blindly highlighting tcsh
@@ -20,36 +21,36 @@ endif
let s:oldcpo = &cpo
set cpo&vim " Line continuation is used
-setlocal iskeyword+=-
+syn iskeyword @,48-57,_,192-255,-
syn case match
-" ----- Clusters -----
+" ----- Clusters ----- {{{1
syn cluster tcshModifiers contains=tcshModifier,tcshModifierError
syn cluster tcshQuoteList contains=tcshDQuote,tcshSQuote,tcshBQuote
-syn cluster tcshStatementEnds contains=@tcshQuoteList,tcshComment,@tcshVarList,tcshRedir,tcshMeta,tcshHereDoc,tcshSpecial,tcshArguement
+syn cluster tcshStatementEnds contains=@tcshQuoteList,tcshComment,@tcshVarList,tcshRedir,tcshMeta,tcshHereDoc,tcshSpecial,tcshArgument
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 -----
+" ----- Errors ----- {{{1
" Define first, so can be easily overridden.
syn match tcshError contained '\v\S.+'
-" ----- Statements -----
+" ----- Statements ----- {{{1
" 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 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
+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 termname time umask uncomplete unhash universe unlimit ver wait warp watchlog where which
" 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=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 tcshShellVar contained addsuffix afsuser ampm anyerror argv autocorrect autoexpand autolist autologout autorehash backslash_quote catalog cdpath cdtohome color colorcat command compat_expr complete continue continue_args correct csubstnonl cwd dextract dirsfile dirstack dspmbyte dunique echo echo_style edit editors ellipsis euid euser fignore filec gid globdot globstar group highlight 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 padhour parseoctal 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 vimode visiblebell watch who wordchars
syn keyword tcshBuiltin nextgroup=tcshSetEnd set unset
syn region tcshSetEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$\|;' contains=tcshShellVar,@tcshStatementEnds
@@ -96,14 +97,15 @@ syn keyword tcshBindkeyFuncs contained backward-char backward-delete-char
\ 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
+ \ list-or-eof load-average magic-space newline newline-and-hold
+ \ newline-and-down-history 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
@@ -116,7 +118,7 @@ syn keyword tcshBindkeyFuncs contained backward-char backward-delete-char
\ 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
+syn region tcshBindkeyEnd contained transparent matchgroup=tcshBuiltin start='' skip='\\$' end='$' contains=@tcshQuoteList,tcshComment,@tcshVarList,tcshMeta,tcshSpecial,tcshArgument,tcshBindkeyFuncs
" Expressions start with @.
syn match tcshExprStart '\v\@\s+' nextgroup=tcshExprVar
@@ -126,20 +128,20 @@ 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: -----
+" ----- Comments: ----- {{{1
syn match tcshComment '#\s.*' contains=tcshTodo,tcshCommentTi,@Spell
syn match tcshComment '\v#($|\S.*)' contains=tcshTodo,tcshCommentTi
syn match tcshSharpBang '^#! .*$'
syn match tcshCommentTi contained '\v#\s*\u\w*(\s+\u\w*)*:'hs=s+1 contains=tcshTodo
syn match tcshTodo contained '\v\c<todo>'
-" ----- Strings -----
+" ----- Strings ----- {{{1
" Tcsh does not allow \" in strings unless the "backslash_quote" shell
" variable is set. Set the vim variable "tcsh_backslash_quote" to 0 if you
" 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)
+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
@@ -149,7 +151,7 @@ else
syn region tcshBQuote keepend matchgroup=tcshBQuoteGrp start='\v\\@<!`' skip='\v\\\\|\\`' end='`' contains=@tcshStatements
endif
-" ----- Variables -----
+" ----- Variables ----- {{{1
" Variable Errors. Must come first! \$ constructs will be flagged by
" tcshSpecial, so we don't consider them here.
syn match tcshVarError '\v\$\S*' contained
@@ -171,7 +173,7 @@ syn match tcshSubst contained '\v\$\{[%#?]%(\h\w*|\d+)%(:\S*)?\}' contains=tcshM
syn match tcshModifierError contained '\v:\S*'
syn match tcshModifier contained '\v:[ag]?[htreuls&qx]' nextgroup=@tcshModifiers
-" ----- Operators / Specials -----
+" ----- Operators / Specials ----- {{{1
" Standard redirects (except <<) [<, >, >>, >>&, >>!, >>&!]
syn match tcshRedir contained '\v\<|\>\>?\&?!?'
@@ -190,13 +192,13 @@ syn match tcshOperator contained '&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|
syn match tcshNumber contained '\v<-?\d+>'
" Arguments
-syn match tcshArguement contained '\v\s@<=-(\w|-)*'
+syn match tcshArgument contained '\v\s@<=-(\w|-)*'
" Special characters. \xxx, or backslashed characters.
"syn match tcshSpecial contained '\v\\@<!\\(\d{3}|.)'
syn match tcshSpecial contained '\v\\%([0-7]{3}|.)'
-" ----- Synchronising -----
+" ----- Synchronising ----- {{{1
if exists('tcsh_minlines')
if tcsh_minlines == 'fromstart'
syn sync fromstart
@@ -207,6 +209,7 @@ else
syn sync minlines=100 " Some completions can be quite long
endif
+" ----- Highlighting ----- {{{1
" Define highlighting of syntax groups
hi def link tcshError Error
hi def link tcshBuiltin Statement
@@ -233,17 +236,20 @@ hi def link tcshVarError Error
hi def link tcshUsrVar Type
hi def link tcshArgv tcshUsrVar
hi def link tcshSubst tcshUsrVar
-hi def link tcshModifier tcshArguement
+hi def link tcshModifier tcshArgument
hi def link tcshModifierError tcshVarError
hi def link tcshMeta tcshSubst
hi def link tcshRedir tcshOperator
hi def link tcshHereDoc tcshSQuote
hi def link tcshOperator Operator
hi def link tcshNumber Number
-hi def link tcshArguement Special
+hi def link tcshArgument Special
hi def link tcshSpecial SpecialChar
+" }}}
let &cpo = s:oldcpo
unlet s:oldcpo
let b:current_syntax = 'tcsh'
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: