blob: 5001cf68bd443e5e36f391c288ef9d90adf8cbc8 [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
Doug Kearns93197fd2024-01-14 20:59:02 +01005" 2024 Jan 14 by Vim Project (browsefilter)
Bram Moolenaar938ae282023-02-20 20:44:55 +00006"
7" Options Flags:
8" dosbatch_colons_comment - any value to treat :: as comment line
Bram Moolenaar071d4272004-06-13 20:20:40 +00009
10" Only do this when not done yet for this buffer
11if exists("b:did_ftplugin")
12 finish
13endif
14
15" Don't load another plugin for this buffer
16let b:did_ftplugin = 1
17
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020018let s:cpo_save = &cpo
19set cpo&vim
20
Bram Moolenaar071d4272004-06-13 20:20:40 +000021" BAT comment formatting
Bram Moolenaar938ae282023-02-20 20:44:55 +000022setlocal comments=b:rem,b:@rem,b:REM,b:@REM
23if exists("dosbatch_colons_comment")
24 setlocal comments+=:::
25 setlocal commentstring=::\ %s
26else
27 setlocal commentstring=REM\ %s
28endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000029setlocal formatoptions-=t formatoptions+=rol
30
Bram Moolenaar2cfb4a22020-05-07 18:56:00 +020031" Lookup DOS keywords using Windows command help.
32if executable('help.exe')
33 if has('terminal')
34 setlocal keywordprg=:term\ help.exe
35 else
36 setlocal keywordprg=help.exe
37 endif
38endif
39
Bram Moolenaar071d4272004-06-13 20:20:40 +000040" Define patterns for the browse file filter
Doug Kearns93197fd2024-01-14 20:59:02 +010041if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
42 let b:browsefilter = "DOS Batch Files (*.bat, *.cmd)\t*.bat;*.cmd\n"
43 if has("win32")
44 let b:browsefilter ..= "All Files (*.*)\t*\n"
45 else
46 let b:browsefilter ..= "All Files (*)\t*\n"
47 endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000048endif
Bram Moolenaard38b0552012-04-25 19:07:41 +020049
Bram Moolenaar2cfb4a22020-05-07 18:56:00 +020050let b:undo_ftplugin = "setlocal comments< formatoptions< keywordprg<"
Doug Kearns93197fd2024-01-14 20:59:02 +010051 \ . "| unlet! b:browsefilter"
Bram Moolenaar1aeaf8c2012-05-18 13:46:39 +020052
53let &cpo = s:cpo_save
54unlet s:cpo_save