vim

Fork of vim, an acceptable text editor
git clone git://git.laack.co/vim.git
Log | Files | Refs | README | LICENSE

basic.vim (2167B)


      1 " Vim filetype plugin file
      2 " Language:	BASIC (QuickBASIC 4.5)
      3 " Maintainer:	Doug Kearns <dougkearns@gmail.com>
      4 " Last Change:	2024 Jan 14
      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 
     14 setlocal comments=:REM\ ,:Rem\ ,:rem\ ,:'
     15 setlocal commentstring='\ %s
     16 setlocal formatoptions-=t formatoptions+=croql
     17 
     18 let b:undo_ftplugin = "setl fo< com< cms<"
     19 
     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 
     41   let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words"
     42 
     43   unlet s:line_start s:not_end s:not_end_or_exit
     44 endif
     45 
     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   if has("win32")
     50     let b:browsefilter ..= "All Files (*.*)\t*\n"
     51   else
     52     let b:browsefilter ..= "All Files (*)\t*\n"
     53   endif
     54   let b:basic_set_browsefilter = 1
     55   let b:undo_ftplugin ..= " | unlet! b:browsefilter b:basic_set_browsefilter"
     56 endif
     57 
     58 let &cpo = s:cpo_save
     59 unlet s:cpo_save
     60 
     61 " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: