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