Bram Moolenaar | e0e3917 | 2021-01-25 21:14:57 +0100 | [diff] [blame] | 1 | " Vim filetype plugin file |
Bram Moolenaar | f10911e | 2022-01-29 22:20:48 +0000 | [diff] [blame] | 2 | " Language: FreeBASIC |
Bram Moolenaar | e0e3917 | 2021-01-25 21:14:57 +0100 | [diff] [blame] | 3 | " Maintainer: Doug Kearns <dougkearns@gmail.com> |
Bram Moolenaar | f10911e | 2022-01-29 22:20:48 +0000 | [diff] [blame] | 4 | " Last Change: 2021 Mar 16 |
Bram Moolenaar | e0e3917 | 2021-01-25 21:14:57 +0100 | [diff] [blame] | 5 | |
Bram Moolenaar | f10911e | 2022-01-29 22:20:48 +0000 | [diff] [blame] | 6 | " Setup {{{1 |
Bram Moolenaar | e0e3917 | 2021-01-25 21:14:57 +0100 | [diff] [blame] | 7 | if exists("b:did_ftplugin") |
| 8 | finish |
| 9 | endif |
Bram Moolenaar | f10911e | 2022-01-29 22:20:48 +0000 | [diff] [blame] | 10 | |
| 11 | let s:cpo_save = &cpo |
| 12 | set cpo&vim |
Bram Moolenaar | e0e3917 | 2021-01-25 21:14:57 +0100 | [diff] [blame] | 13 | |
| 14 | runtime! ftplugin/basic.vim |
| 15 | |
Bram Moolenaar | f10911e | 2022-01-29 22:20:48 +0000 | [diff] [blame] | 16 | let s:dialect = freebasic#GetDialect() |
| 17 | |
| 18 | " Comments {{{1 |
| 19 | " add ''comments before 'comments |
| 20 | let &l:comments = "sO:*\ -,mO:*\ \ ,exO:*/,s1:/',mb:',ex:'/,:''," .. &l:comments |
| 21 | |
| 22 | " Match words {{{1 |
| 23 | if 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 |
| 59 | endif |
| 60 | |
| 61 | " Cleanup {{{1 |
| 62 | let &cpo = s:cpo_save |
| 63 | unlet s:cpo_save |
| 64 | |
| 65 | " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: |