blob: 58c2b4c9e20b3d6f9a767c0b3131ff9fb3738318 [file] [log] [blame]
Bram Moolenaare0e39172021-01-25 21:14:57 +01001" Vim filetype plugin file
Bram Moolenaarf10911e2022-01-29 22:20:48 +00002" Language: FreeBASIC
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
Bram Moolenaarf10911e2022-01-29 22:20:48 +00006" Setup {{{1
Bram Moolenaare0e39172021-01-25 21:14:57 +01007if exists("b:did_ftplugin")
8 finish
9endif
Bram Moolenaarf10911e2022-01-29 22:20:48 +000010
11let s:cpo_save = &cpo
12set cpo&vim
Bram Moolenaare0e39172021-01-25 21:14:57 +010013
14runtime! ftplugin/basic.vim
15
Bram Moolenaarf10911e2022-01-29 22:20:48 +000016let s:dialect = freebasic#GetDialect()
17
18" Comments {{{1
19" add ''comments before 'comments
20let &l:comments = "sO:*\ -,mO:*\ \ ,exO:*/,s1:/',mb:',ex:'/,:''," .. &l:comments
21
22" Match words {{{1
23if exists("loaded_matchit")
24 let s:not_end = '\%(end\s\+\)\@<!'
25
26 let b:match_words ..= ','
27
28 if s:dialect == 'fb'
29 let b:match_words ..= s:not_end .. '\<constructor\>:\<end\s\+constructor\>,' ..
30 \ s:not_end .. '\<destructor\>:\<end\s\+destructor\>,' ..
31 \ s:not_end .. '\<property\>:\<end\s\+property\>,' ..
32 \ s:not_end .. '\<operator\>:\<end\s\+operator\>,' ..
33 \ s:not_end .. '\<extern\%(\s\+"\)\@=:\<end\s\+extern\>,'
34 endif
35
36 if s:dialect == 'fb' || s:dialect == 'deprecated'
37 let b:match_words ..= s:not_end .. '\<scope\>:\<end\s\+scope\>,'
38 endif
39
40 if s:dialect == 'qb'
41 let b:match_words ..= s:not_end .. '\<__asm\>:\<end\s\+__asm\>,' ..
42 \ s:not_end .. '\<__union\>:\<end\s\+__union\>,' ..
43 \ s:not_end .. '\<__with\>:\<end\s\+__with\>,'
44 else
45 let b:match_words ..= s:not_end .. '\<asm\>:\<end\s\+asm\>,' ..
46 \ s:not_end .. '\<namespace\>:\<end\s\+namespace\>,' ..
47 \ s:not_end .. '\<union\>:\<end\s\+union\>,' ..
48 \ s:not_end .. '\<with\>:\<end\s\+with\>,'
49 endif
50
51 let b:match_words ..= s:not_end .. '\<enum\>:\<end\s\+enum\>,' ..
52 \ '^#\s*\%(if\|ifdef\|ifndef\)\>:^#\s*\%(else\|elseif\)\>:^#\s*endif\>,' ..
53 \ '^#\s*macro\>:^#\s*endmacro\>'
54
55 " skip "function = <retval>"
56 let b:match_skip ..= '|| strpart(getline("."), col(".") - 1) =~? "^\\<function\\s\\+="'
57
58 unlet s:not_end
59endif
60
61" Cleanup {{{1
62let &cpo = s:cpo_save
63unlet s:cpo_save
64
65" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: