2014-07-10 21:05:51 -07:00
|
|
|
" Vim filetype plugin file
|
2021-10-16 08:07:40 -07:00
|
|
|
" Language: csh
|
|
|
|
" Maintainer: Doug Kearns <dougkearns@gmail.com>
|
2022-03-09 00:40:16 -07:00
|
|
|
" Previous Maintainer: Dan Sharp
|
2021-10-16 08:07:40 -07:00
|
|
|
" Contributor: Johannes Zellner <johannes@zellner.org>
|
2024-01-15 03:12:32 -07:00
|
|
|
" Last Change: 2024 Jan 14
|
2014-07-10 21:05:51 -07:00
|
|
|
|
2023-10-14 07:04:05 -07:00
|
|
|
if exists("b:did_ftplugin")
|
|
|
|
finish
|
|
|
|
endif
|
2014-07-10 21:05:51 -07:00
|
|
|
let b:did_ftplugin = 1
|
|
|
|
|
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo-=C
|
|
|
|
|
2021-10-16 08:07:40 -07:00
|
|
|
setlocal comments=:#
|
2014-07-10 21:05:51 -07:00
|
|
|
setlocal commentstring=#%s
|
|
|
|
setlocal formatoptions-=t
|
|
|
|
setlocal formatoptions+=crql
|
|
|
|
|
2021-10-16 08:07:40 -07:00
|
|
|
let b:undo_ftplugin = "setlocal com< cms< fo<"
|
|
|
|
|
2023-10-14 07:04:05 -07:00
|
|
|
" Csh: thanks to Johannes Zellner
|
2014-07-10 21:05:51 -07:00
|
|
|
" - Both foreach and end must appear alone on separate lines.
|
|
|
|
" - The words else and endif must appear at the beginning of input lines;
|
|
|
|
" the if must appear alone on its input line or after an else.
|
|
|
|
" - Each case label and the default label must appear at the start of a
|
|
|
|
" line.
|
|
|
|
" - while and end must appear alone on their input lines.
|
2021-10-16 08:07:40 -07:00
|
|
|
if exists("loaded_matchit") && !exists("b:match_words")
|
|
|
|
let s:line_start = '\%(^\s*\)\@<='
|
|
|
|
let b:match_words =
|
|
|
|
\ s:line_start .. 'if\s*(.*)\s*then\>:' ..
|
|
|
|
\ s:line_start .. 'else\s\+if\s*(.*)\s*then\>:' .. s:line_start .. 'else\>:' ..
|
|
|
|
\ s:line_start .. 'endif\>,' ..
|
|
|
|
\ s:line_start .. '\%(\<foreach\s\+\h\w*\|while\)\s*(:' ..
|
|
|
|
\ '\<break\>:\<continue\>:' ..
|
|
|
|
\ s:line_start .. 'end\>,' ..
|
|
|
|
\ s:line_start .. 'switch\s*(:' ..
|
|
|
|
\ s:line_start .. 'case\s\+:' .. s:line_start .. 'default\>:\<breaksw\>:' ..
|
|
|
|
\ s:line_start .. 'endsw\>'
|
|
|
|
unlet s:line_start
|
2023-10-14 07:04:05 -07:00
|
|
|
let b:undo_ftplugin ..= " | unlet! b:match_words"
|
2014-07-10 21:05:51 -07:00
|
|
|
endif
|
|
|
|
|
2021-10-16 08:07:40 -07:00
|
|
|
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
2024-01-15 03:12:32 -07:00
|
|
|
let b:browsefilter = "csh Scripts (*.csh)\t*.csh\n"
|
|
|
|
if has("win32")
|
|
|
|
let b:browsefilter ..= "All Files (*.*)\t*\n"
|
|
|
|
else
|
|
|
|
let b:browsefilter ..= "All Files (*)\t*\n"
|
|
|
|
endif
|
2023-10-14 07:04:05 -07:00
|
|
|
let b:csh_set_browsefilter = 1
|
|
|
|
let b:undo_ftplugin ..= " | unlet! b:browsefilter b:csh_set_browsefilter"
|
2014-07-10 21:05:51 -07:00
|
|
|
endif
|
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|