" Vim filetype plugin file " Language: csh " Maintainer: Doug Kearns " Previous Maintainer: Dan Sharp " Contributor: Johannes Zellner " Riley Bruins " Last Change: 2026 Jan 16 if exists("b:did_ftplugin") finish endif let b:did_ftplugin = 1 let s:save_cpo = &cpo set cpo-=C setlocal comments=:# setlocal commentstring=#\ %s setlocal formatoptions-=t setlocal formatoptions+=crql let b:undo_ftplugin = "setlocal com< cms< fo<" if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 let b:match_words = "CshMatchWords()" let b:match_skip = "CshMatchSkip()" let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words" endif " skip single line 'if' commands function CshMatchSkip() return getline(".") =~# '^\s*if\>' && !s:CshIsIfThenCommand() endfunction function CshMatchWords() let line_start = '\%(^\s*\)\@<=' let match_words = \ line_start .. '\%(foreach\s\+\h\w*\s*(\|while\>\):' .. \ '\:\:' .. \ line_start .. 'end\>,' .. \ line_start .. 'switch\s*(:' .. \ line_start .. 'case\s\+:' .. line_start .. 'default\>:\:' .. \ line_start .. 'endsw\>' if expand("") =~# '\' && !s:CshIsIfThenCommand() return match_words else return match_words .. "," .. \ line_start .. 'if\>:' .. \ line_start .. 'else\s\+if\>:' .. line_start .. 'else\>:' .. \ line_start .. 'endif\>' endif endfunction function s:CshIsIfThenCommand() let lnum = line(".") let line = getline(lnum) " join continued lines while lnum < line("$") && line =~ '^\%([^\\]\|\\\\\)*\\$' let lnum += 1 let line = substitute(line, '\\$', '', '') .. getline(lnum) endwhile " TODO: confirm with syntax checks when the highlighting is more accurate return line =~# '^\s*if\>.*\