From 2f234d86470f4e515a8cb75233a1d3bda1e037f6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 24 Jan 2026 08:09:22 +0800 Subject: [PATCH] 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 --- runtime/syntax/csh.vim | 12 +++++------- runtime/syntax/tcsh.vim | 37 +++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/runtime/syntax/csh.vim b/runtime/syntax/csh.vim index 0ad85adfc70..cf1c68d65fc 100644 --- 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 +" 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 index 6837125129b..70265e29108 100644 --- a/runtime/syntax/tcsh.vim +++ b/runtime/syntax/tcsh.vim @@ -2,7 +2,7 @@ " Language: tcsh scripts " Maintainer: Doug Kearns " Previous Maintainer: Gautam Iyer 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' +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' " 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\\@\>?\&?!?' 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