blob: 929823219c49df0c56f1524297e4f444661a456a [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
Bram Moolenaar22863042021-10-16 15:23:36 +01002" Language: csh
3" Maintainer: Doug Kearns <dougkearns@gmail.com>
4" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net>
5" Contributor: Johannes Zellner <johannes@zellner.org>
6" Last Change: 2021 Oct 15
Bram Moolenaar071d4272004-06-13 20:20:40 +00007
8if exists("b:did_ftplugin") | finish | endif
9let b:did_ftplugin = 1
10
Bram Moolenaar071d4272004-06-13 20:20:40 +000011let s:save_cpo = &cpo
12set cpo-=C
13
Bram Moolenaar22863042021-10-16 15:23:36 +010014setlocal comments=:#
Bram Moolenaar071d4272004-06-13 20:20:40 +000015setlocal commentstring=#%s
16setlocal formatoptions-=t
17setlocal formatoptions+=crql
18
Bram Moolenaar22863042021-10-16 15:23:36 +010019let b:undo_ftplugin = "setlocal com< cms< fo<"
20
Bram Moolenaar071d4272004-06-13 20:20:40 +000021" Csh: thanks to Johannes Zellner
22" - Both foreach and end must appear alone on separate lines.
23" - The words else and endif must appear at the beginning of input lines;
24" the if must appear alone on its input line or after an else.
25" - Each case label and the default label must appear at the start of a
26" line.
27" - while and end must appear alone on their input lines.
Bram Moolenaar22863042021-10-16 15:23:36 +010028if exists("loaded_matchit") && !exists("b:match_words")
29 let s:line_start = '\%(^\s*\)\@<='
30 let b:match_words =
31 \ s:line_start .. 'if\s*(.*)\s*then\>:' ..
32 \ s:line_start .. 'else\s\+if\s*(.*)\s*then\>:' .. s:line_start .. 'else\>:' ..
33 \ s:line_start .. 'endif\>,' ..
34 \ s:line_start .. '\%(\<foreach\s\+\h\w*\|while\)\s*(:' ..
35 \ '\<break\>:\<continue\>:' ..
36 \ s:line_start .. 'end\>,' ..
37 \ s:line_start .. 'switch\s*(:' ..
38 \ s:line_start .. 'case\s\+:' .. s:line_start .. 'default\>:\<breaksw\>:' ..
39 \ s:line_start .. 'endsw\>'
40 unlet s:line_start
41 let b:undo_ftplugin ..= " | unlet b:match_words"
Bram Moolenaar071d4272004-06-13 20:20:40 +000042endif
43
Bram Moolenaar22863042021-10-16 15:23:36 +010044if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
45 let b:browsefilter="csh Scripts (*.csh)\t*.csh\n" ..
46 \ "All Files (*.*)\t*.*\n"
47 let b:undo_ftplugin ..= " | unlet b:browsefilter"
Bram Moolenaar071d4272004-06-13 20:20:40 +000048endif
49
Bram Moolenaar071d4272004-06-13 20:20:40 +000050let &cpo = s:save_cpo
Bram Moolenaar84f72352012-03-11 15:57:40 +010051unlet s:save_cpo