blob: a8f6b088d146ff0a9c399ddcb88a28e23716cca1 [file] [log] [blame]
Bram Moolenaare0e39172021-01-25 21:14:57 +01001" Vim filetype plugin file
Bram Moolenaarf10911e2022-01-29 22:20:48 +00002" Language: BASIC (QuickBASIC 4.5)
Bram Moolenaare0e39172021-01-25 21:14:57 +01003" Maintainer: Doug Kearns <dougkearns@gmail.com>
Bram Moolenaarf10911e2022-01-29 22:20:48 +00004" Last Change: 2021 Mar 16
Bram Moolenaare0e39172021-01-25 21:14:57 +01005
6if exists("b:did_ftplugin")
7 finish
8endif
9let b:did_ftplugin = 1
10
11let s:cpo_save = &cpo
12set cpo&vim
13
Bram Moolenaarf10911e2022-01-29 22:20:48 +000014setlocal comments=:REM\ ,:Rem\ ,:rem\ ,:'
Bram Moolenaare0e39172021-01-25 21:14:57 +010015setlocal commentstring='\ %s
16setlocal formatoptions-=t formatoptions+=croql
17
Bram Moolenaarf10911e2022-01-29 22:20:48 +000018" TODO: support exit ... as middle matches?
19if 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
Bram Moolenaare0e39172021-01-25 21:14:57 +010041endif
42
Bram Moolenaarf10911e2022-01-29 22:20:48 +000043if (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"
47endif
48
49let b:undo_ftplugin = "setl fo< com< cms<" ..
50 \ " | unlet! b:match_ignorecase b:match_skip b:match_words" ..
51 \ " | unlet! b:browsefilter"
Bram Moolenaare0e39172021-01-25 21:14:57 +010052
53let &cpo = s:cpo_save
54unlet s:cpo_save
Bram Moolenaarf10911e2022-01-29 22:20:48 +000055
56" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: