codekingpro/portable-devtools
114k
1" Vim syntax file2" Language: C-shell (csh)3" Maintainer: Doug Kearns <dougkearns@gmail.com>4" Former Maintainer: Charles E. Campbell5" Last Change: 2026 Jan 166 7" quit when a syntax file was already loaded8if exists("b:current_syntax")9 finish10endif11 12" clusters:13syn cluster cshQuoteList contains=cshDblQuote,cshSnglQuote,cshBckQuote14syn cluster cshVarList contains=cshExtVar,cshSelector,cshQtyWord,cshArgv,cshSubst15 16" Variables which affect the csh itself17syn match cshSetVariables contained "argv\|histchars\|ignoreeof\|noglob\|prompt\|status"18syn match cshSetVariables contained "cdpath\|history\|mail\|nonomatch\|savehist\|time"19syn match cshSetVariables contained "cwd\|home\|noclobber\|path\|shell\|verbose"20syn match cshSetVariables contained "echo"21 22syn case ignore23syn keyword cshTodo contained todo24syn case match25 26" Variable Name Expansion Modifiers27syn match cshModifier contained ":\(h\|t\|r\|q\|x\|gh\|gt\|gr\)"28 29" Strings and Comments30syn match cshNoEndlineDQ contained "[^\"]\(\\\\\)*$"31syn match cshNoEndlineSQ contained "[^\']\(\\\\\)*$"32syn match cshNoEndlineBQ contained "[^\`]\(\\\\\)*$"33 34syn region cshDblQuote start=+[^\\]"+lc=1 skip=+\\\\\|\\"+ end=+"+ contains=cshSpecial,cshShellVariables,cshExtVar,cshSelector,cshQtyWord,cshArgv,cshSubst,cshNoEndlineDQ,cshBckQuote,@Spell35syn region cshSnglQuote start=+[^\\]'+lc=1 skip=+\\\\\|\\'+ end=+'+ contains=cshNoEndlineSQ,@Spell36syn region cshBckQuote start=+[^\\]`+lc=1 skip=+\\\\\|\\`+ end=+`+ contains=cshNoEndlineBQ,@Spell37syn region cshDblQuote start=+^"+ skip=+\\\\\|\\"+ end=+"+ contains=cshSpecial,cshExtVar,cshSelector,cshQtyWord,cshArgv,cshSubst,cshNoEndlineDQ,@Spell38syn region cshSnglQuote start=+^'+ skip=+\\\\\|\\'+ end=+'+ contains=cshNoEndlineSQ,@Spell39syn region cshBckQuote start=+^`+ skip=+\\\\\|\\`+ end=+`+ contains=cshNoEndlineBQ,@Spell40syn cluster cshCommentGroup contains=cshTodo,@Spell41syn match cshComment "#.*" contains=@cshCommentGroup42 43" A bunch of useful csh keywords44syn keyword cshStatement alias end history onintr setenv unalias45syn keyword cshStatement cd eval kill popd shift unhash46syn keyword cshStatement chdir exec login pushd source47syn keyword cshStatement continue exit logout rehash time unsetenv48syn keyword cshStatement dirs glob nice repeat umask wait49syn keyword cshStatement echo goto nohup50 51syn keyword cshConditional break case else endsw switch52syn keyword cshConditional breaksw default endif53syn keyword cshRepeat foreach54 55" Special environment variables56syn keyword cshShellVariables HOME LOGNAME PATH TERM USER57 58" Modifiable Variables without {}59syn match cshExtVar "\$[a-zA-Z_][a-zA-Z0-9_]*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=" contains=cshModifier60syn match cshSelector "\$[a-zA-Z_][a-zA-Z0-9_]*\[[a-zA-Z_]\+\]\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=" contains=cshModifier61syn match cshQtyWord "\$#[a-zA-Z_][a-zA-Z0-9_]*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=" contains=cshModifier62syn match cshArgv "\$\d\+\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=" contains=cshModifier63syn match cshArgv "\$\*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=" contains=cshModifier64 65" Modifiable Variables with {}66syn match cshExtVar "\${[a-zA-Z_][a-zA-Z0-9_]*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=}" contains=cshModifier67syn match cshSelector "\${[a-zA-Z_][a-zA-Z0-9_]*\[[a-zA-Z_]\+\]\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=}" contains=cshModifier68syn match cshQtyWord "\${#[a-zA-Z_][a-zA-Z0-9_]*\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=}" contains=cshModifier69syn match cshArgv "\${\d\+\(:h\|:t\|:r\|:q\|:x\|:gh\|:gt\|:gr\)\=}" contains=cshModifier70 71" UnModifiable Substitutions72syn match cshSubstError "\$?[a-zA-Z_][a-zA-Z0-9_]*:\(h\|t\|r\|q\|x\|gh\|gt\|gr\)"73syn match cshSubstError "\${?[a-zA-Z_][a-zA-Z0-9_]*:\(h\|t\|r\|q\|x\|gh\|gt\|gr\)}"74syn match cshSubstError "\$?[0$<]:\(h\|t\|r\|q\|x\|gh\|gt\|gr\)"75syn match cshSubst "\$?[a-zA-Z_][a-zA-Z0-9_]*"76syn match cshSubst "\${?[a-zA-Z_][a-zA-Z0-9_]*}"77syn match cshSubst "\$?[0$<]"78 79" I/O redirection80syn match cshRedir ">>&!\|>&!\|>>&\|>>!\|>&\|>!\|>>\|<<\|>\|<"81 82" Handle set expressions83syn region cshSetExpr matchgroup=cshSetStmt start="\<set\>\|\<unset\>" end="$\|;" contains=cshComment,cshSetStmt,cshSetVariables,@cshQuoteList84 85" Operators and Expression-Using constructs86"syn match cshOperator contained "&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|\~\|||\|!\|\|%\|&\|+\|-\|/\|<\|>\||"87syn match cshOperator contained "&&\|!\~\|!=\|<<\|<=\|==\|=\~\|>=\|>>\|\*\|\^\|\~\|||\|!\|%\|&\|+\|-\|/\|<\|>\||"88syn match cshOperator contained "[(){}]"89syn region cshTest matchgroup=cshStatement start="\<if\>\|\<while\>" skip="\\$" matchgroup=cshStatement end="\<then\>\|$" contains=cshComment,cshOperator,@cshQuoteList,@cshVarLIst90 91" Highlight special characters (those which have a backslash) differently92syn match cshSpecial contained "\\\d\d\d\|\\[abcfnrtv\\]"93syn match cshNumber "-\=\<\d\+\>"94 95" All other identifiers96"syn match cshIdentifier "\<[a-zA-Z._][a-zA-Z0-9._]*\>"97 98" Shell Input Redirection (Here Documents)99syn region cshHereDoc matchgroup=cshRedir start="<<-\=\s*\**\z(\h\w*\)\**" matchgroup=cshRedir end="^\z1$"100 101" Define the default highlighting.102if !exists("skip_csh_syntax_inits")103 104 hi def link cshArgv cshVariables105 hi def link cshBckQuote cshCommand106 hi def link cshDblQuote cshString107 hi def link cshExtVar cshVariables108 hi def link cshHereDoc cshString109 hi def link cshNoEndlineBQ cshNoEndline110 hi def link cshNoEndlineDQ cshNoEndline111 hi def link cshNoEndlineSQ cshNoEndline112 hi def link cshQtyWord cshVariables113 hi def link cshRedir cshOperator114 hi def link cshSelector cshVariables115 hi def link cshSetStmt cshStatement116 hi def link cshSetVariables cshVariables117 hi def link cshSnglQuote cshString118 hi def link cshSubst cshVariables119 120 hi def link cshCommand Statement121 hi def link cshComment Comment122 hi def link cshConditional Conditional123 hi def link cshIdentifier Error124 hi def link cshModifier Special125 hi def link cshNoEndline Error126 hi def link cshNumber Number127 hi def link cshOperator Operator128 hi def link cshRedir Statement129 hi def link cshRepeat Repeat130 hi def link cshShellVariables Special131 hi def link cshSpecial Special132 hi def link cshStatement Statement133 hi def link cshString String134 hi def link cshSubstError Error135 hi def link cshTodo Todo136 hi def link cshVariables Type137 138endif139 140let b:current_syntax = "csh"141 142" vim: ts=18143 