commit 2f234d86470f4e515a8cb75233a1d3bda1e037f6
parent e0b724de09c287cd47f2669cdc47e4c3835ae083
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat, 24 Jan 2026 08:09:22 +0800
vim-patch:95bb4ef: runtime(csh,tcsh): Update syntax files
- Adopt csh syntax file.
- Highlight tcsh strings with the String highlight group.
- Fix 'set' command highlighting with trailing comments. See
https://github.com/vim/vim/pull/19172#issuecomment-3751574224
- Fix whitespace style in MAINTAINERS file
closes: vim/vim#19191
https://github.com/vim/vim/commit/95bb4ef7d1b07591ae1a7d3616432bbbe6858dd1
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat:
2 files changed, 24 insertions(+), 25 deletions(-)
diff --git a/runtime/syntax/csh.vim b/runtime/syntax/csh.vim
@@ -1,10 +1,8 @@
" Vim syntax file
-" Language: C-shell (csh)
-" Maintainer: This runtime file is looking for a new maintainer.
-" Former Maintainer: Charles E. Campbell
-" Last Change: Aug 31, 2016
-" Version: 14
-" Former URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_CSH
+" Language: C-shell (csh)
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Former Maintainer: Charles E. Campbell
+" Last Change: 2026 Jan 16
" quit when a syntax file was already loaded
if exists("b:current_syntax")
@@ -40,7 +38,7 @@ syn region cshDblQuote start=+^"+ skip=+\\\\\|\\"+ end=+"+ contains=cshSpecial
syn region cshSnglQuote start=+^'+ skip=+\\\\\|\\'+ end=+'+ contains=cshNoEndlineSQ,@Spell
syn region cshBckQuote start=+^`+ skip=+\\\\\|\\`+ end=+`+ contains=cshNoEndlineBQ,@Spell
syn cluster cshCommentGroup contains=cshTodo,@Spell
-syn match cshComment "#.*$" contains=@cshCommentGroup
+syn match cshComment "#.*" contains=@cshCommentGroup
" A bunch of useful csh keywords
syn keyword cshStatement alias end history onintr setenv unalias
diff --git a/runtime/syntax/tcsh.vim b/runtime/syntax/tcsh.vim
@@ -2,7 +2,7 @@
" 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
+" Last Change: 2026 Jan 16
" 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
@@ -129,11 +129,12 @@ syn match tcshExprEnd contained '\v.*$'hs=e+1 contains=@tcshConditions
syn match tcshExprEnd contained '\v.{-};'hs=e contains=@tcshConditions
" ----- 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>'
+syn match tcshSharpBang '\%^#!.*$'
+syn match tcshComment '#.*' contains=tcshTodo,@Spell
+syn match tcshTodo contained '\v%(^\s*#\s*)@<=\c<%(TODO|FIXME|XXX)>'
+
+" TODO: leading whitespace match is needed to prevent keyword matching
+syn match tcshLabel '^\s*\w\+:\ze\s*$'
" ----- Strings ----- {{{1
" Tcsh does not allow \" in strings unless the "backslash_quote" shell
@@ -141,14 +142,14 @@ 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="'"
- syn region tcshDQuote keepend contained start='\v\\@<!"' end='"' contains=@tcshVarList,tcshSpecial,@Spell
- syn region tcshBQuote keepend start='\v\\@<!`' end='`' contains=@tcshStatements
+if get(g:, 'tcsh_backslash_quote', 1)
+ syn region tcshSQuote contained start="'" skip="\v\\\\|\\'" end="'"
+ syn region tcshDQuote contained start='"' end='"' contains=@tcshVarList,tcshSpecial,@Spell
+ syn region tcshBQuote keepend matchgroup=tcshBQuoteGrp start='`' skip='\v\\\\|\\`' end='`' contains=@tcshStatements
else
- 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
+ syn region tcshSQuote keepend contained start="'" end="'"
+ syn region tcshDQuote keepend contained start='"' end='"' contains=@tcshVarList,tcshSpecial,@Spell
+ syn region tcshBQuote keepend start='`' end='`' contains=@tcshStatements
endif
" ----- Variables ----- {{{1
@@ -181,8 +182,8 @@ syn match tcshRedir contained '\v\<|\>\>?\&?!?'
syn match tcshMeta contained '\v[]{}*?[]'
" 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$'
+syn region tcshHereDoc contained matchgroup=tcshShellVar start='\v\<\<\s*\z(\h\w*)' end='^\z1$' contains=@tcshVarList,tcshSpecial fold
+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$' fold
" Operators
syn match tcshOperator contained '&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|\~\|||\|!\|%\|&\|+\|-\|/\|<\|>\||'
@@ -226,10 +227,9 @@ 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 tcshSharpBang tcshCommentTi
+hi def link tcshSharpBang PreProc
hi def link tcshTodo Todo
-hi def link tcshSQuote Constant
+hi def link tcshSQuote String
hi def link tcshDQuote tcshSQuote
hi def link tcshBQuoteGrp Include
hi def link tcshVarError Error
@@ -245,6 +245,7 @@ hi def link tcshOperator Operator
hi def link tcshNumber Number
hi def link tcshArgument Special
hi def link tcshSpecial SpecialChar
+hi def link tcshLabel Label
" }}}
let &cpo = s:oldcpo