mirror of
https://github.com/vim/vim.git
synced 2026-05-07 19:06:33 +02:00
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: #19191 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
d532b01c36
commit
95bb4ef7d1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
20
runtime/syntax/testdir/dumps/csh_00.dump
Normal file
20
runtime/syntax/testdir/dumps/csh_00.dump
Normal file
@@ -0,0 +1,20 @@
|
||||
>#+0#0000e05#ffffff0| |h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|p|u|l@1|/|1|9|1|7|2|#|i|s@1|u|e|c|o|m@1|e|n|t|-|3|7|5|1|5|7|4|2@1|4| +0#0000000&@11
|
||||
@75
|
||||
|s+0#af5f00255&|e|t| +0#0000000&|s|c|r|i|p|t|_|d|i|r|=|"+0#e000002&@1| +0#0000000&|#+0#0000e05&|c|o|m@1|e|n|t| +0#0000000&@48
|
||||
|s+0#af5f00255&|e|t| +0#0000000&|s|c|r|i|p|t|_|d|i|r|=|"+0#e000002&@1| +0#0000000&@57
|
||||
|s+0#af5f00255&|e|t| +0#0000000&|s|c|r|i|p|t|_|d|i|r|=|"+0#e000002&@1| +0#0000000&|#+0#0000e05&| +0#0000000&@55
|
||||
@75
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|1|,|1| @10|A|l@1|
|
||||
20
runtime/syntax/testdir/dumps/tcsh_00.dump
Normal file
20
runtime/syntax/testdir/dumps/tcsh_00.dump
Normal file
@@ -0,0 +1,20 @@
|
||||
>#+0#0000e05#ffffff0| |h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|p|u|l@1|/|1|9|1|7|2|#|i|s@1|u|e|c|o|m@1|e|n|t|-|3|7|5|1|5|7|4|2@1|4| +0#0000000&@11
|
||||
@75
|
||||
|s+0#af5f00255&|e|t| +0#0000000&|s|c|r|i|p|t|_|d|i|r|=|"+0#e000002&@1| +0#0000000&|#+0#0000e05&|c|o|m@1|e|n|t| +0#0000000&@48
|
||||
|s+0#af5f00255&|e|t| +0#0000000&|s|c|r|i|p|t|_|d|i|r|=|"+0#e000002&@1| +0#0000000&@57
|
||||
|s+0#af5f00255&|e|t| +0#0000000&|s|c|r|i|p|t|_|d|i|r|=|"+0#e000002&@1| +0#0000000&|#+0#0000e05&| +0#0000000&@55
|
||||
@75
|
||||
|~+0#4040ff13&| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
|~| @73
|
||||
| +0#0000000&@56|1|,|1| @10|A|l@1|
|
||||
6
runtime/syntax/testdir/input/csh.csh
Normal file
6
runtime/syntax/testdir/input/csh.csh
Normal file
@@ -0,0 +1,6 @@
|
||||
# https://github.com/vim/vim/pull/19172#issuecomment-3751574224
|
||||
|
||||
set script_dir="" #comment
|
||||
set script_dir=""
|
||||
set script_dir="" #
|
||||
|
||||
6
runtime/syntax/testdir/input/tcsh.tcsh
Normal file
6
runtime/syntax/testdir/input/tcsh.tcsh
Normal file
@@ -0,0 +1,6 @@
|
||||
# https://github.com/vim/vim/pull/19172#issuecomment-3751574224
|
||||
|
||||
set script_dir="" #comment
|
||||
set script_dir=""
|
||||
set script_dir="" #
|
||||
|
||||
Reference in New Issue
Block a user