blob: f02f26b1fd170326106c2eadfa3a153bc90c5901 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
Bram Moolenaar938ae282023-02-20 20:44:55 +00002" Language: MS-DOS/Windows .bat files
3" Maintainer: Mike Williams <mrmrdubya@gmail.com>
4" Last Change: 12th February 2023
5"
6" Options Flags:
7" dosbatch_colons_comment - any value to treat :: as comment line
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
9" Only do this when not done yet for this buffer
10if exists("b:did_ftplugin")
11 finish
12endif
13
14" Don't load another plugin for this buffer
15let b:did_ftplugin = 1
16
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020017let s:cpo_save = &cpo
18set cpo&vim
19
Bram Moolenaar071d4272004-06-13 20:20:40 +000020" BAT comment formatting
Bram Moolenaar938ae282023-02-20 20:44:55 +000021setlocal comments=b:rem,b:@rem,b:REM,b:@REM
22if exists("dosbatch_colons_comment")
23 setlocal comments+=:::
24 setlocal commentstring=::\ %s
25else
26 setlocal commentstring=REM\ %s
27endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000028setlocal formatoptions-=t formatoptions+=rol
29
Bram Moolenaar2cfb4a22020-05-07 18:56:00 +020030" Lookup DOS keywords using Windows command help.
31if executable('help.exe')
32 if has('terminal')
33 setlocal keywordprg=:term\ help.exe
34 else
35 setlocal keywordprg=help.exe
36 endif
37endif
38
Bram Moolenaar071d4272004-06-13 20:20:40 +000039" Define patterns for the browse file filter
40if has("gui_win32") && !exists("b:browsefilter")
Bram Moolenaar5c736222010-01-06 20:54:52 +010041 let b:browsefilter = "DOS Batch Files (*.bat, *.cmd)\t*.bat;*.cmd\nAll Files (*.*)\t*.*\n"
Bram Moolenaar071d4272004-06-13 20:20:40 +000042endif
Bram Moolenaard38b0552012-04-25 19:07:41 +020043
Bram Moolenaar2cfb4a22020-05-07 18:56:00 +020044let b:undo_ftplugin = "setlocal comments< formatoptions< keywordprg<"
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020045 \ . "| unlet! b:browsefiler"
46
47let &cpo = s:cpo_save
48unlet s:cpo_save