From 79b92da0d289d1adcd0bb27c7ee5786be460c166 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 31 Jan 2022 15:27:01 +0100 Subject: vim-patch:partial:f10911e5db16 (#17248) Update runtime files https://github.com/vim/vim/commit/f10911e5db16f1fe6ab519c5d091ad0c1df0d063 --- runtime/ftplugin/basic.vim | 43 +++++++++++++++++++++++++----- runtime/ftplugin/freebasic.vim | 60 +++++++++++++++++++++++++++++++++++++++--- runtime/ftplugin/qb64.vim | 26 ++++++++++++++++++ 3 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 runtime/ftplugin/qb64.vim (limited to 'runtime/ftplugin') diff --git a/runtime/ftplugin/basic.vim b/runtime/ftplugin/basic.vim index c6ec254dfc..a8f6b088d1 100644 --- a/runtime/ftplugin/basic.vim +++ b/runtime/ftplugin/basic.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: BASIC +" Language: BASIC (QuickBASIC 4.5) " Maintainer: Doug Kearns -" Last Change: 2015 Jan 10 +" Last Change: 2021 Mar 16 if exists("b:did_ftplugin") finish @@ -11,17 +11,46 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -setlocal comments=:REM,:' +setlocal comments=:REM\ ,:Rem\ ,:rem\ ,:' setlocal commentstring='\ %s setlocal formatoptions-=t formatoptions+=croql +" TODO: support exit ... as middle matches? +if exists("loaded_matchit") && !exists("b:match_words") + let s:line_start = '\%(^\s*\)\@<=' + let s:not_end = '\%(end\s\+\)\@,' .. + \ s:not_end_or_exit .. '\:\,' .. + \ s:not_end_or_exit .. '\:\,' .. + \ s:not_end .. '\:\,' .. + \ s:not_end .. '\:\%(select\s\+\)\@:\,' .. + \ '\:\,' .. + \ '\\%(\s\+\%(input\|output\|random\|append\|binary\)\)\@!:\,' .. + \ '\:\,' .. + \ s:line_start .. 'if\%(.*\:\,' .. + \ '\:\' + + let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string" || ' .. + \ 'strpart(getline("."), 0, col(".") ) =~? "\\ -" 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) =~? "^\\ + +if exists("b:did_ftplugin") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +runtime! ftplugin/basic.vim + +let s:not_end = '\%(end\s\+\)\@:\,' .. + \ '\:\%(select\s\+\)\@:\,' .. + \ '$IF\>:$\%(ELSEIF\|ELSE\)\>:$END\s*IF\>' + +unlet s:not_end + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: -- cgit