23737
|
1 " Vim filetype plugin file
|
27459
|
2 " Language: BASIC (QuickBASIC 4.5)
|
23737
|
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
|
27459
|
4 " Last Change: 2021 Mar 16
|
23737
|
5
|
|
6 if exists("b:did_ftplugin")
|
|
7 finish
|
|
8 endif
|
|
9 let b:did_ftplugin = 1
|
|
10
|
|
11 let s:cpo_save = &cpo
|
|
12 set cpo&vim
|
|
13
|
27459
|
14 setlocal comments=:REM\ ,:Rem\ ,:rem\ ,:'
|
23737
|
15 setlocal commentstring='\ %s
|
|
16 setlocal formatoptions-=t formatoptions+=croql
|
|
17
|
27459
|
18 " TODO: support exit ... as middle matches?
|
|
19 if exists("loaded_matchit") && !exists("b:match_words")
|
|
20 let s:line_start = '\%(^\s*\)\@<='
|
|
21 let s:not_end = '\%(end\s\+\)\@<!'
|
|
22 let s:not_end_or_exit = '\%(\%(end\|exit\)\s\+\)\@<!'
|
|
23
|
|
24 let b:match_ignorecase = 1
|
|
25 let b:match_words =
|
|
26 \ s:not_end_or_exit .. '\<def\s\+fn:\<end\s\+def\>,' ..
|
|
27 \ s:not_end_or_exit .. '\<function\>:\<end\s\+function\>,' ..
|
|
28 \ s:not_end_or_exit .. '\<sub\>:\<end\s\+sub\>,' ..
|
|
29 \ s:not_end .. '\<type\>:\<end\s\+type\>,' ..
|
|
30 \ s:not_end .. '\<select\>:\%(select\s\+\)\@<!\<case\%(\s\+\%(else\|is\)\)\=\>:\<end\s\+select\>,' ..
|
|
31 \ '\<do\>:\<loop\>,' ..
|
|
32 \ '\<for\>\%(\s\+\%(input\|output\|random\|append\|binary\)\)\@!:\<next\>,' ..
|
|
33 \ '\<while\>:\<wend\>,' ..
|
|
34 \ s:line_start .. 'if\%(.*\<then\s*\%($\|''\)\)\@=:\<\%(' .. s:line_start .. 'else\|elseif\)\>:\<end\s\+if\>,' ..
|
|
35 \ '\<lock\>:\<unlock\>'
|
|
36
|
|
37 let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string" || ' ..
|
|
38 \ 'strpart(getline("."), 0, col(".") ) =~? "\\<exit\\s\\+"'
|
|
39
|
|
40 unlet s:line_start s:not_end s:not_end_or_exit
|
23737
|
41 endif
|
|
42
|
27459
|
43 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
|
|
44 let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" ..
|
|
45 \ "BASIC Include Files (*.bi, *.bm)\t*.bi;*.bm\n" ..
|
|
46 \ "All Files (*.*)\t*.*\n"
|
|
47 endif
|
|
48
|
|
49 let b:undo_ftplugin = "setl fo< com< cms<" ..
|
|
50 \ " | unlet! b:match_ignorecase b:match_skip b:match_words" ..
|
|
51 \ " | unlet! b:browsefilter"
|
23737
|
52
|
|
53 let &cpo = s:cpo_save
|
|
54 unlet s:cpo_save
|
27459
|
55
|
|
56 " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
|