robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
0bb2f5cc08
master
1" Vim filetype plugin file 2" Language: FreeBASIC 3" Maintainer: Doug Kearns <dougkearns@gmail.com> 4" Last Change: 2023 Aug 22 5 6" Setup {{{1 7if exists ( "b:did_ftplugin" ) 8finish 9endif 10 11let s: cpo_save = & cpo 12set cpo & vim 13 14runtime ! ftplugin/basic[.]{vim,lua} 15 16let 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" ) 24let s: line_start = '\%(^\s*\)\@<=' 25let s: not_end = '\%(end\s\+\)\@<!' 26 27let b: match_words ..= ',' 28 29if s: dialect == 'fb' 30let b: match_words ..= s: not_end .. '\<constructor\>:\<end\s\+constructor\>,' .. 31 \s: not_end .. '\<destructor\>:\<end\s\+destructor\>,' .. 32 \s: not_end .. '\<property\>:\<end\s\+property\>,' .. 33 \s: not_end .. '\<operator\>:\<end\s\+operator\>,' .. 34 \s: not_end .. '\<extern\%(\s\+"\)\@=:\<end\s\+extern\>,' 35endif 36 37if s: dialect == 'fb' || s: dialect == 'deprecated' 38let b: match_words ..= s: not_end .. '\<scope\>:\<end\s\+scope\>,' 39endif 40 41if s: dialect == 'qb' 42let b: match_words ..= s: not_end .. '\<__asm\>:\<end\s\+__asm\>,' .. 43 \s: not_end .. '\<__union\>:\<end\s\+__union\>,' .. 44 \s: not_end .. '\<__with\>:\<end\s\+__with\>,' 45else 46let b: match_words ..= s: not_end .. '\<asm\>:\<end\s\+asm\>,' .. 47 \s: not_end .. '\<namespace\>:\<end\s\+namespace\>,' .. 48 \s: not_end .. '\<union\>:\<end\s\+union\>,' .. 49 \s: not_end .. '\<with\>:\<end\s\+with\>,' 50endif 51 52let b: match_words ..= s: not_end .. '\<enum\>:\<end\s\+enum\>,' .. 53 \s: line_start .. '#\s*\%(if\|ifdef\|ifndef\)\>:' .. 54 \s: line_start .. '#\s*\%(else\|elseif\)\>:' .. 55 \s: line_start .. '#\s*endif\>,' .. 56 \s: line_start .. '#\s*macro\>:' .. s: line_start .. '#\s*endmacro\>,' .. 57 \"/':'/" 58 59" skip "function = <retval>" and "continue { do | for | while }" 60if s: dialect == "qb" 61let s: continue = "__continue" 62else 63let s: continue = "continue" 64endif 65let b: match_skip ..= ' || strpart(getline("."), col(".") - 1) =~? "^\\<function\\s\\+="' .. 66 \' || strpart(getline("."), 0, col(".") ) =~? "\\<' .. s: continue .. '\\s\\+"' 67 68unlet s: not_end s: line_start 69endif 70 71if ( has ( "gui_win32" ) || has ( "gui_gtk" )) && exists ( "b:basic_set_browsefilter" ) 72let b: browsefilter = "FreeBASIC Source Files (*.bas)\t*.bas\n" .. 73 \"FreeBASIC Header Files (*.bi)\t*.bi\n" 74if has ( "win32" ) 75let b: browsefilter ..= "All Files (*.*)\t*\n" 76else 77let b: browsefilter ..= "All Files (*)\t*\n" 78endif 79endif 80 81" Cleanup {{{1 82let & cpo = s: cpo_save 83unlet s: cpo_save s: dialect 84 85" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: