From b77c5f11070ecb2ff343aa18b4ea859e6168f16c Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Thu, 17 Feb 2022 04:31:35 +0100 Subject: Update --- ftplugin/freebasic.vim | 60 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 4 deletions(-) (limited to 'ftplugin/freebasic.vim') diff --git a/ftplugin/freebasic.vim b/ftplugin/freebasic.vim index d2212481..41aa2d30 100644 --- a/ftplugin/freebasic.vim +++ b/ftplugin/freebasic.vim @@ -3,15 +3,67 @@ if polyglot#init#is_disabled(expand(':p'), 'freebasic', 'ftplugin/freebas endif " Vim filetype plugin file -" Language: FreeBasic +" Language: FreeBASIC " Maintainer: Doug Kearns -" Last Change: 2015 Jan 10 +" Last Change: 2021 Mar 16 +" Setup {{{1 if exists("b:did_ftplugin") finish endif -let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim runtime! ftplugin/basic.vim -" vim: ts=8 +let s:dialect = freebasic#GetDialect() + +" Comments {{{1 +" add ''comments before 'comments +let &l:comments = "sO:*\ -,mO:*\ \ ,exO:*/,s1:/',mb:',ex:'/,:''," .. &l:comments + +" Match words {{{1 +if exists("loaded_matchit") + let s:not_end = '\%(end\s\+\)\@:\,' .. + \ s:not_end .. '\:\,' .. + \ s:not_end .. '\:\,' .. + \ s:not_end .. '\:\,' .. + \ s:not_end .. '\,' + endif + + if s:dialect == 'fb' || s:dialect == 'deprecated' + let b:match_words .= s:not_end .. '\:\,' + endif + + if s:dialect == 'qb' + let b:match_words .= s:not_end .. '\<__asm\>:\,' .. + \ s:not_end .. '\<__union\>:\,' .. + \ s:not_end .. '\<__with\>:\,' + else + let b:match_words .= s:not_end .. '\:\,' .. + \ s:not_end .. '\:\,' .. + \ s:not_end .. '\:\,' .. + \ s:not_end .. '\:\,' + endif + + let b:match_words .= s:not_end .. '\:\,' .. + \ '^#\s*\%(if\|ifdef\|ifndef\)\>:^#\s*\%(else\|elseif\)\>:^#\s*endif\>,' .. + \ '^#\s*macro\>:^#\s*endmacro\>' + + " skip "function = " + let b:match_skip .= '|| strpart(getline("."), col(".") - 1) =~? "^\\