blob: b6fdb8f3e2eb585338ffab3bedd21b440016eb62 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
Bram Moolenaar71b6d332022-09-10 13:13:14 +01002" Language: sh
3" Maintainer: Doug Kearns <dougkearns@gmail.com>
4" Previous Maintainer: Dan Sharp
5" Last Change: 2022 Sep 07
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
Bram Moolenaar71b6d332022-09-10 13:13:14 +01007if exists("b:did_ftplugin")
8 finish
9endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000010let b:did_ftplugin = 1
11
12" Make sure the continuation lines below do not cause problems in
13" compatibility mode.
14let s:save_cpo = &cpo
15set cpo-=C
16
Bram Moolenaar71b6d332022-09-10 13:13:14 +010017setlocal comments=:#
18setlocal commentstring=#\ %s
19setlocal formatoptions-=t formatoptions+=croql
20
21let b:undo_ftplugin = "setl com< cms< fo<"
Bram Moolenaar071d4272004-06-13 20:20:40 +000022
23" Shell: thanks to Johannes Zellner
Bram Moolenaar71b6d332022-09-10 13:13:14 +010024if exists("loaded_matchit") && !exists("b:match_words")
25 let b:match_ignorecase = 0
26 let s:sol = '\%(;\s*\|^\s*\)\@<=' " start of line
27 let b:match_words =
28 \ s:sol .. 'if\>:' .. s:sol.'elif\>:' .. s:sol.'else\>:' .. s:sol .. 'fi\>,' ..
29 \ s:sol .. '\%(for\|while\)\>:' .. s:sol .. 'done\>,' ..
30 \ s:sol .. 'case\>:' .. s:sol .. 'esac\>'
31 unlet s:sol
32 let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words"
Bram Moolenaar071d4272004-06-13 20:20:40 +000033endif
34
35" Change the :browse e filter to primarily show shell-related files.
Bram Moolenaar71b6d332022-09-10 13:13:14 +010036if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
37 let b:browsefilter = "Bourne Shell Scripts (*.sh)\t*.sh\n" ..
38 \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" ..
39 \ "Bash Shell Scripts (*.bash)\t*.bash\n" ..
40 \ "All Files (*.*)\t*.*\n"
41 let b:undo_ftplugin ..= " | unlet! b:browsefilter"
Bram Moolenaar071d4272004-06-13 20:20:40 +000042endif
43
Bram Moolenaar071d4272004-06-13 20:20:40 +000044" Restore the saved compatibility options.
45let &cpo = s:save_cpo
Bram Moolenaar84f72352012-03-11 15:57:40 +010046unlet s:save_cpo
Bram Moolenaar71b6d332022-09-10 13:13:14 +010047
48" vim: nowrap sw=2 sts=2 ts=8 noet: