aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/dist/ft.vim6
-rw-r--r--runtime/autoload/freebasic.vim42
-rw-r--r--runtime/doc/builtin.txt26
-rw-r--r--runtime/doc/change.txt2
-rw-r--r--runtime/doc/indent.txt9
-rw-r--r--runtime/doc/index.txt4
-rw-r--r--runtime/doc/options.txt9
-rw-r--r--runtime/filetype.vim4
-rw-r--r--runtime/ftplugin/basic.vim43
-rw-r--r--runtime/ftplugin/freebasic.vim60
-rw-r--r--runtime/ftplugin/qb64.vim26
-rw-r--r--runtime/indent/basic.vim11
-rw-r--r--runtime/indent/freebasic.vim11
-rw-r--r--runtime/indent/html.vim15
-rw-r--r--runtime/indent/qb64.vim11
-rw-r--r--runtime/indent/testdir/html.in13
-rw-r--r--runtime/indent/testdir/html.ok13
-rw-r--r--runtime/lua/vim/filetype.lua2
-rw-r--r--runtime/pack/dist/opt/matchit/autoload/matchit.vim4
-rw-r--r--runtime/syntax/basic.vim482
-rw-r--r--runtime/syntax/qb64.vim409
-rw-r--r--runtime/syntax/strace.vim3
-rw-r--r--src/nvim/buffer.c6
-rw-r--r--src/nvim/eval.c3
-rw-r--r--src/nvim/keymap.h2
-rw-r--r--src/nvim/option.c27
-rw-r--r--src/nvim/option_defs.h2
-rw-r--r--src/nvim/testdir/test_options.vim2
-rw-r--r--test/functional/fixtures/autoload/provider/python3.vim (renamed from test/functional/fixtures/autoload/provider/python.vim)2
-rw-r--r--test/functional/provider/provider_spec.lua4
30 files changed, 1040 insertions, 213 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim
index 86c71fa52d..f513a2ac8f 100644
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -1,7 +1,7 @@
" Vim functions for file type detection
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Jan 11
+" Last Change: 2022 Jan 31
" These functions are moved here from runtime/filetype.vim to make startup
" faster.
@@ -67,7 +67,7 @@ func dist#ft#FTasmsyntax()
endif
endfunc
-func dist#ft#FTbas()
+func dist#ft#FTbas(alt = '')
if exists("g:filetype_bas")
exe "setf " . g:filetype_bas
return
@@ -88,6 +88,8 @@ func dist#ft#FTbas()
setf qb64
elseif match(lines, '\cVB_Name\|Begin VB\.\(Form\|MDIForm\|UserControl\)') > -1
setf vb
+ elseif a:alt != ''
+ exe 'setf ' .. a:alt
else
setf basic
endif
diff --git a/runtime/autoload/freebasic.vim b/runtime/autoload/freebasic.vim
new file mode 100644
index 0000000000..fe6d2745be
--- /dev/null
+++ b/runtime/autoload/freebasic.vim
@@ -0,0 +1,42 @@
+" Vim filetype plugin file
+" Language: FreeBASIC
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2021 Mar 16
+
+" Dialects can be one of fb, qb, fblite, or deprecated
+" Precedence is forcelang > #lang > lang
+function! freebasic#GetDialect() abort
+ if exists("g:freebasic_forcelang")
+ return g:freebasic_forcelang
+ endif
+
+ if exists("g:freebasic_lang")
+ let dialect = g:freebasic_lang
+ else
+ let dialect = "fb"
+ endif
+
+ " override with #lang directive or metacommand
+
+ let skip = "has('syntax_items') && synIDattr(synID(line('.'), col('.'), 1), 'name') =~ 'Comment$'"
+ let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"'
+
+ let save_cursor = getcurpos()
+ call cursor(1, 1)
+ " let lnum = search(pat, 'n', '', '', skip) " 'skip' needs 8.2.0915
+ let lnum = search(pat, 'n', '', '')
+ call setpos('.', save_cursor)
+
+ if lnum
+ let word = matchlist(getline(lnum), pat)[1]
+ if word =~? '\%(fb\|deprecated\|fblite\|qb\)'
+ let dialect = word
+ else
+ echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum)
+ endif
+ endif
+
+ return dialect
+endfunction
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index a421de078b..bb04376f57 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -1723,6 +1723,19 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is
For checking if a file exists use |filereadable()|.
The {expr} argument is a string, which contains one of these:
+ varname internal variable (see
+ dict.key |internal-variables|). Also works
+ list[i] for |curly-braces-names|, |Dictionary|
+ entries, |List| items, etc.
+ Beware that evaluating an index may
+ cause an error message for an invalid
+ expression. E.g.: >
+ :let l = [1, 2, 3]
+ :echo exists("l[5]")
+< 0 >
+ :echo exists("l[xx]")
+< E121: Undefined variable: xx
+ 0
&option-name Vim option (only checks if it exists,
not if it really works)
+option-name Vim option that works.
@@ -1733,19 +1746,6 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is
or user defined function (see
|user-function|). Also works for a
variable that is a Funcref.
- varname internal variable (see
- |internal-variables|). Also works
- for |curly-braces-names|, |Dictionary|
- entries, |List| items, etc. Beware
- that evaluating an index may cause an
- error message for an invalid
- expression. E.g.: >
- :let l = [1, 2, 3]
- :echo exists("l[5]")
-< 0 >
- :echo exists("l[xx]")
-< E121: Undefined variable: xx
- 0
:cmdname Ex command: built-in command, user
command or command modifier |:command|.
Returns:
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index 953f097a92..e26a84f80f 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -1121,7 +1121,7 @@ deleting the selection.)
The previously selected text is put in the unnamed register. If you want to
put the same text into a Visual selection several times you need to use
another register. E.g., yank the text to copy, Visually select the text to
-replace and use "0p . You can repeat this as many times as you like, the
+replace and use "0p . You can repeat this as many times as you like, and the
unnamed register will be changed each time.
When you use a blockwise Visual mode command and yank only a single line into
diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt
index a76f8636f8..d0d4ddad32 100644
--- a/runtime/doc/indent.txt
+++ b/runtime/doc/indent.txt
@@ -771,6 +771,15 @@ You can set the indent for the first line after <script> and <style>
"auto" auto indent (same indent as the blocktag)
"inc" auto indent + one indent step
+You can set the indent for attributes after an open <tag line: >
+
+ :let g:html_indent_attribute = 1
+<
+ VALUE MEANING ~
+ 1 auto indent, one indent step more than <tag
+ 2 auto indent, two indent steps (default)
+ > 2 auto indent, more indent steps
+
Many tags increase the indent for what follows per default (see "Add Indent
Tags" in the script). You can add further tags with: >
diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt
index d8689e2c65..f02f9f8032 100644
--- a/runtime/doc/index.txt
+++ b/runtime/doc/index.txt
@@ -923,7 +923,7 @@ tag command note action in Visual mode ~
before the highlighted area
|v_J| J 2 join the highlighted lines
|v_K| K run 'keywordprg' on the highlighted area
-|v_O| O Move horizontally to other corner of area.
+|v_O| O move horizontally to other corner of area.
Q does not start Ex mode
|v_R| R 2 delete the highlighted lines and start
insert
@@ -986,6 +986,8 @@ tag command note action in Visual mode ~
|v_i{| i{ same as iB
|v_i}| i} same as iB
|v_o| o move cursor to other corner of area
+|v_p| p replace highlighted area with register
+ contents; deleted text in unnamed register
|v_r| r 2 replace highlighted area with a character
|v_s| s 2 delete highlighted area and start insert
|v_u| u 2 make highlighted area lowercase
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index df5fad06a0..82cd743f20 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1220,8 +1220,8 @@ A jump table for the options with a short description can be found at |Q_op|.
preferred, because it is much faster.
'charconvert' is not used when reading stdin |--|, because there is no
file to convert from. You will have to save the text in a file first.
- The expression must return zero or an empty string for success,
- non-zero for failure.
+ The expression must return zero, false or an empty string for success,
+ non-zero or true for failure.
See |encoding-names| for possible encoding names.
Additionally, names given in 'fileencodings' and 'fileencoding' are
used.
@@ -6254,10 +6254,11 @@ A jump table for the options with a short description can be found at |Q_op|.
'tabstop' 'ts' number (default 8)
local to buffer
Number of spaces that a <Tab> in the file counts for. Also see
- |:retab| command, and 'softtabstop' option.
+ the |:retab| command, and the 'softtabstop' option.
Note: Setting 'tabstop' to any other value than 8 can make your file
- appear wrong in many places (e.g., when printing it).
+ appear wrong in many places, e.g., when printing it.
+ The value must be more than 0 and less than 10000.
There are four main ways to use tabs in Vim:
1. Always keep 'tabstop' at 8, set 'softtabstop' and 'shiftwidth' to 4
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 28ecf8844e..7c86809cb8 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Jan 23
+" Last Change: 2022 Jan 31
" Listen very carefully, I will say this only once
if exists("did_load_filetypes")
@@ -2050,7 +2050,7 @@ au BufRead,BufNewFile *.hw,*.module,*.pkg
\ endif
" Visual Basic (also uses *.bas) or FORM
-au BufNewFile,BufRead *.frm call dist#ft#FTVB("form")
+au BufNewFile,BufRead *.frm call dist#ft#FTbas('form')
" SaxBasic is close to Visual Basic
au BufNewFile,BufRead *.sba setf vb
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 <dougkearns@gmail.com>
-" 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\+\)\@<!'
+ let s:not_end_or_exit = '\%(\%(end\|exit\)\s\+\)\@<!'
+
+ let b:match_ignorecase = 1
+ let b:match_words =
+ \ s:not_end_or_exit .. '\<def\s\+fn:\<end\s\+def\>,' ..
+ \ s:not_end_or_exit .. '\<function\>:\<end\s\+function\>,' ..
+ \ s:not_end_or_exit .. '\<sub\>:\<end\s\+sub\>,' ..
+ \ s:not_end .. '\<type\>:\<end\s\+type\>,' ..
+ \ s:not_end .. '\<select\>:\%(select\s\+\)\@<!\<case\%(\s\+\%(else\|is\)\)\=\>:\<end\s\+select\>,' ..
+ \ '\<do\>:\<loop\>,' ..
+ \ '\<for\>\%(\s\+\%(input\|output\|random\|append\|binary\)\)\@!:\<next\>,' ..
+ \ '\<while\>:\<wend\>,' ..
+ \ s:line_start .. 'if\%(.*\<then\s*\%($\|''\)\)\@=:\<\%(' .. s:line_start .. 'else\|elseif\)\>:\<end\s\+if\>,' ..
+ \ '\<lock\>:\<unlock\>'
+
+ let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string" || ' ..
+ \ 'strpart(getline("."), 0, col(".") ) =~? "\\<exit\\s\\+"'
+
+ unlet s:line_start s:not_end s:not_end_or_exit
+endif
+
if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
- let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" .
- \ "All Files (*.*)\t*.*\n"
+ let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" ..
+ \ "BASIC Include Files (*.bi, *.bm)\t*.bi;*.bm\n" ..
+ \ "All Files (*.*)\t*.*\n"
endif
-let b:undo_ftplugin = "setl fo< com< cms< sua<" .
- \ " | unlet! b:browsefilter"
+let b:undo_ftplugin = "setl fo< com< cms<" ..
+ \ " | unlet! b:match_ignorecase b:match_skip b:match_words" ..
+ \ " | unlet! b:browsefilter"
let &cpo = s:cpo_save
unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/ftplugin/freebasic.vim b/runtime/ftplugin/freebasic.vim
index a2bb459f20..58c2b4c9e2 100644
--- a/runtime/ftplugin/freebasic.vim
+++ b/runtime/ftplugin/freebasic.vim
@@ -1,13 +1,65 @@
" Vim filetype plugin file
-" Language: FreeBasic
+" Language: FreeBASIC
" Maintainer: Doug Kearns <dougkearns@gmail.com>
-" 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\+\)\@<!'
+
+ let b:match_words ..= ','
+
+ if s:dialect == 'fb'
+ let b:match_words ..= s:not_end .. '\<constructor\>:\<end\s\+constructor\>,' ..
+ \ s:not_end .. '\<destructor\>:\<end\s\+destructor\>,' ..
+ \ s:not_end .. '\<property\>:\<end\s\+property\>,' ..
+ \ s:not_end .. '\<operator\>:\<end\s\+operator\>,' ..
+ \ s:not_end .. '\<extern\%(\s\+"\)\@=:\<end\s\+extern\>,'
+ endif
+
+ if s:dialect == 'fb' || s:dialect == 'deprecated'
+ let b:match_words ..= s:not_end .. '\<scope\>:\<end\s\+scope\>,'
+ endif
+
+ if s:dialect == 'qb'
+ let b:match_words ..= s:not_end .. '\<__asm\>:\<end\s\+__asm\>,' ..
+ \ s:not_end .. '\<__union\>:\<end\s\+__union\>,' ..
+ \ s:not_end .. '\<__with\>:\<end\s\+__with\>,'
+ else
+ let b:match_words ..= s:not_end .. '\<asm\>:\<end\s\+asm\>,' ..
+ \ s:not_end .. '\<namespace\>:\<end\s\+namespace\>,' ..
+ \ s:not_end .. '\<union\>:\<end\s\+union\>,' ..
+ \ s:not_end .. '\<with\>:\<end\s\+with\>,'
+ endif
+
+ let b:match_words ..= s:not_end .. '\<enum\>:\<end\s\+enum\>,' ..
+ \ '^#\s*\%(if\|ifdef\|ifndef\)\>:^#\s*\%(else\|elseif\)\>:^#\s*endif\>,' ..
+ \ '^#\s*macro\>:^#\s*endmacro\>'
+
+ " skip "function = <retval>"
+ let b:match_skip ..= '|| strpart(getline("."), col(".") - 1) =~? "^\\<function\\s\\+="'
+
+ unlet s:not_end
+endif
+
+" Cleanup {{{1
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/ftplugin/qb64.vim b/runtime/ftplugin/qb64.vim
new file mode 100644
index 0000000000..0fa36fc3d2
--- /dev/null
+++ b/runtime/ftplugin/qb64.vim
@@ -0,0 +1,26 @@
+" Vim filetype plugin file
+" Language: QB64
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+
+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\+\)\@<!'
+
+let b:match_words ..= ',' ..
+ \ s:not_end .. '\<declare\>:\<end\s\+declare\>,' ..
+ \ '\<select\s\+everycase\>:\%(select\s\+\)\@<!\<case\%(\s\+\%(else\|is\)\)\=\>:\<end\s\+select\>,' ..
+ \ '$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:
diff --git a/runtime/indent/basic.vim b/runtime/indent/basic.vim
new file mode 100644
index 0000000000..7228772251
--- /dev/null
+++ b/runtime/indent/basic.vim
@@ -0,0 +1,11 @@
+" Vim indent file
+" Language: BASIC (QuickBASIC 4.5)
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 24
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+runtime! indent/vb.vim
diff --git a/runtime/indent/freebasic.vim b/runtime/indent/freebasic.vim
new file mode 100644
index 0000000000..248b928635
--- /dev/null
+++ b/runtime/indent/freebasic.vim
@@ -0,0 +1,11 @@
+" Vim indent file
+" Language: FreeBASIC
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 24
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+runtime! indent/vb.vim
diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim
index d4b91f6421..a3c32d6342 100644
--- a/runtime/indent/html.vim
+++ b/runtime/indent/html.vim
@@ -1,7 +1,7 @@
" Vim indent script for HTML
" Maintainer: Bram Moolenaar
" Original Author: Andy Wokula <anwoku@yahoo.de>
-" Last Change: 2021 Jun 13
+" Last Change: 2022 Jan 31
" Version: 1.0 "{{{
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@@ -149,6 +149,15 @@ func HtmlIndent_CheckUserSettings()
let b:html_indent_line_limit = 200
endif
endif
+
+ if exists('b:html_indent_attribute')
+ let b:hi_attr_indent = b:html_indent_attribute
+ elseif exists('g:html_indent_attribute')
+ let b:hi_attr_indent = g:html_indent_attribute
+ else
+ let b:hi_attr_indent = 2
+ endif
+
endfunc "}}}
" Init Script Vars
@@ -946,11 +955,11 @@ func s:InsideTag(foundHtmlString)
let idx = match(text, '<' . s:tagname . '\s\+\zs\w')
endif
if idx == -1
- " after just "<tag" indent two levels more
+ " after just "<tag" indent two levels more by default
let idx = match(text, '<' . s:tagname . '$')
if idx >= 0
call cursor(lnum, idx + 1)
- return virtcol('.') - 1 + shiftwidth() * 2
+ return virtcol('.') - 1 + shiftwidth() * b:hi_attr_indent
endif
endif
if idx > 0
diff --git a/runtime/indent/qb64.vim b/runtime/indent/qb64.vim
new file mode 100644
index 0000000000..09f815c43d
--- /dev/null
+++ b/runtime/indent/qb64.vim
@@ -0,0 +1,11 @@
+" Vim indent file
+" Language: QB64
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 24
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+runtime! indent/vb.vim
diff --git a/runtime/indent/testdir/html.in b/runtime/indent/testdir/html.in
index 1acf8c0402..b62c67ddb2 100644
--- a/runtime/indent/testdir/html.in
+++ b/runtime/indent/testdir/html.in
@@ -1,4 +1,4 @@
-" vim: set ft=html sw=4 :
+" vim: set ft=html sw=4 ts=8 :
" START_INDENT
@@ -41,6 +41,11 @@ dd text
dt text
</dt>
</dl>
+<div
+class="test"
+style="color: yellow">
+text
+</div>
</body>
</html>
@@ -50,6 +55,7 @@ dt text
% START_INDENT
% INDENT_EXE let g:html_indent_style1 = "inc"
% INDENT_EXE let g:html_indent_script1 = "zero"
+% INDENT_EXE let g:html_indent_attribute = 1
% INDENT_EXE call HtmlIndent_CheckUserSettings()
<html>
<body>
@@ -61,6 +67,11 @@ div#d2 { color: green; }
var v1 = "v1";
var v2 = "v2";
</script>
+<div
+class="test"
+style="color: yellow">
+text
+</div>
</body>
</html>
% END_INDENT
diff --git a/runtime/indent/testdir/html.ok b/runtime/indent/testdir/html.ok
index c0dfc9dc72..938e965d8c 100644
--- a/runtime/indent/testdir/html.ok
+++ b/runtime/indent/testdir/html.ok
@@ -1,4 +1,4 @@
-" vim: set ft=html sw=4 :
+" vim: set ft=html sw=4 ts=8 :
" START_INDENT
@@ -41,6 +41,11 @@ div#d2 { color: green; }
dt text
</dt>
</dl>
+ <div
+ class="test"
+ style="color: yellow">
+ text
+ </div>
</body>
</html>
@@ -50,6 +55,7 @@ div#d2 { color: green; }
% START_INDENT
% INDENT_EXE let g:html_indent_style1 = "inc"
% INDENT_EXE let g:html_indent_script1 = "zero"
+% INDENT_EXE let g:html_indent_attribute = 1
% INDENT_EXE call HtmlIndent_CheckUserSettings()
<html>
<body>
@@ -61,6 +67,11 @@ div#d2 { color: green; }
var v1 = "v1";
var v2 = "v2";
</script>
+ <div
+ class="test"
+ style="color: yellow">
+ text
+ </div>
</body>
</html>
% END_INDENT
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index adc838578d..ff44f48195 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -789,7 +789,7 @@ local extension = {
ex = function() vim.fn["dist#ft#ExCheck"]() end,
exu = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
exw = function() vim.fn["dist#ft#EuphoriaCheck"]() end,
- frm = function() vim.fn["dist#ft#FTVB"]("form") end,
+ frm = function() vim.fn["dist#ft#FTbas"]("form") end,
fs = function() vim.fn["dist#ft#FTfs"]() end,
h = function() vim.fn["dist#ft#FTheader"]() end,
htm = function() vim.fn["dist#ft#FThtml"]() end,
diff --git a/runtime/pack/dist/opt/matchit/autoload/matchit.vim b/runtime/pack/dist/opt/matchit/autoload/matchit.vim
index e8689980ae..eafb7c0551 100644
--- a/runtime/pack/dist/opt/matchit/autoload/matchit.vim
+++ b/runtime/pack/dist/opt/matchit/autoload/matchit.vim
@@ -763,9 +763,9 @@ fun! s:ParseSkip(str)
let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" ..
\ strpart(skip,2) .. "'"
elseif skip[0] == "r"
- let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'"
+ let skip = "strpart(getline('.'),0,col('.'))=~'" .. strpart(skip,2) .. "'"
elseif skip[0] == "R"
- let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'"
+ let skip = "strpart(getline('.'),0,col('.'))!~'" .. strpart(skip,2) .. "'"
endif
endif
return skip
diff --git a/runtime/syntax/basic.vim b/runtime/syntax/basic.vim
index ad9450b3b8..7fe411a869 100644
--- a/runtime/syntax/basic.vim
+++ b/runtime/syntax/basic.vim
@@ -1,14 +1,15 @@
" Vim syntax file
-" Language: BASIC
+" Language: BASIC (QuickBASIC 4.5)
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Previous Maintainer: Allan Kelly <allan@fruitloaf.co.uk>
" Contributors: Thilo Six
-" Last Change: 2015 Jan 10
+" Last Change: 2021 Aug 08
" First version based on Micro$soft QBASIC circa 1989, as documented in
" 'Learn BASIC Now' by Halvorson&Rygmyr. Microsoft Press 1989.
-" This syntax file not a complete implementation yet. Send suggestions to the
-" maintainer.
+"
+" Second version attempts to match Microsoft QuickBASIC 4.5 while keeping FreeBASIC
+" (-lang qb) and QB64 (excluding extensions) in mind. -- DJK
" Prelude {{{1
if exists("b:current_syntax")
@@ -18,154 +19,357 @@ endif
let s:cpo_save = &cpo
set cpo&vim
+syn iskeyword @,48-57,.,!,#,%,&,$
+syn case ignore
+
+" Whitespace Errors {{{1
+if exists("basic_space_errors")
+ if !exists("basic_no_trail_space_error")
+ syn match basicSpaceError display excludenl "\s\+$"
+ endif
+ if !exists("basic_no_tab_space_error")
+ syn match basicSpaceError display " \+\t"me=e-1
+ endif
+endif
+
+" Comment Errors {{{1
+if !exists("basic_no_comment_errors")
+ syn match basicCommentError "\<REM\>.*"
+endif
+
+" Not Top Cluster {{{1
+syn cluster basicNotTop contains=@basicLineIdentifier,basicDataString,basicDataSeparator,basicTodo
+
+" Statements {{{1
+
+syn cluster basicStatements contains=basicStatement,basicDataStatement,basicMetaRemStatement,basicPutStatement,basicRemStatement
+
+let s:statements =<< trim EOL " {{{2
+ beep
+ bload
+ bsave
+ call
+ calls
+ case
+ chain
+ chdir
+ circle
+ clear
+ close
+ cls
+ color
+ com
+ common
+ const
+ declare
+ def
+ def\s\+seg
+ defdbl
+ defint
+ deflng
+ defsng
+ defstr
+ dim
+ do
+ draw
+ elseif
+ end
+ end\s\+\%(def\|function\|if\|select\|sub\|type\)
+ environ
+ erase
+ error
+ exit\s\+\%(def\|do\|for\|function\|sub\)
+ field
+ files
+ for
+ function
+ get
+ gosub
+ goto
+ if
+ input
+ ioctl
+ key
+ kill
+ let
+ line
+ line\s\+input
+ locate
+ lock
+ loop
+ lprint
+ lset
+ mkdir
+ name
+ next
+ on
+ on\s\+error
+ on\s\+uevent
+ open
+ open\s\+com
+ option
+ out
+ paint
+ palette
+ palette\s\+using
+ pcopy
+ pen
+ pmap
+ poke
+ preset
+ print
+ pset
+ randomize
+ read
+ redim
+ reset
+ restore
+ resume
+ return
+ rmdir
+ rset
+ run
+ select\s\+case
+ shared
+ shell
+ sleep
+ sound
+ static
+ stop
+ strig
+ sub
+ swap
+ system
+ troff
+ tron
+ type
+ uevent
+ unlock
+ using
+ view
+ view\s\+print
+ wait
+ wend
+ while
+ width
+ window
+ write
+EOL
+" }}}
+
+for s in s:statements
+ exe 'syn match basicStatement "\<' .. s .. '\>" contained'
+endfor
+
+syn match basicStatement "\<\%(then\|else\)\>" nextgroup=@basicStatements skipwhite
+
+" DATA Statement
+syn match basicDataSeparator "," contained
+syn region basicDataStatement matchgroup=basicStatement start="\<data\>" matchgroup=basicStatementSeparator end=":\|$" contained contains=basicDataSeparator,basicDataString,basicNumber,basicFloat,basicString
+
+if !exists("basic_no_data_fold")
+ syn region basicMultilineData start="^\s*\<data\>.*\n\%(^\s*\<data\>\)\@=" end="^\s*\<data\>.*\n\%(^\s*\<data\>\)\@!" contains=basicDataStatement transparent fold keepend
+endif
+
+" PUT File I/O and Graphics statements - needs special handling for graphics
+" action verbs
+syn match basicPutAction "\<\%(pset\|preset\|and\|or\|xor\)\>" contained
+syn region basicPutStatement matchgroup=basicStatement start="\<put\>" matchgroup=basicStatementSeparator end=":\|$" contained contains=basicKeyword,basicPutAction,basicFilenumber
+
" Keywords {{{1
-syn keyword basicStatement BEEP beep Beep BLOAD bload Bload BSAVE bsave Bsave
-syn keyword basicStatement CALL call Call ABSOLUTE absolute Absolute
-syn keyword basicStatement CHAIN chain Chain CHDIR chdir Chdir
-syn keyword basicStatement CIRCLE circle Circle CLEAR clear Clear
-syn keyword basicStatement CLOSE close Close CLS cls Cls COLOR color Color
-syn keyword basicStatement COM com Com COMMON common Common
-syn keyword basicStatement CONST const Const DATA data Data
-syn keyword basicStatement DECLARE declare Declare DEF def Def
-syn keyword basicStatement DEFDBL defdbl Defdbl DEFINT defint Defint
-syn keyword basicStatement DEFLNG deflng Deflng DEFSNG defsng Defsng
-syn keyword basicStatement DEFSTR defstr Defstr DIM dim Dim
-syn keyword basicStatement DO do Do LOOP loop Loop
-syn keyword basicStatement DRAW draw Draw END end End
-syn keyword basicStatement ENVIRON environ Environ ERASE erase Erase
-syn keyword basicStatement ERROR error Error EXIT exit Exit
-syn keyword basicStatement FIELD field Field FILES files Files
-syn keyword basicStatement FOR for For NEXT next Next
-syn keyword basicStatement FUNCTION function Function GET get Get
-syn keyword basicStatement GOSUB gosub Gosub GOTO goto Goto
-syn keyword basicStatement IF if If THEN then Then ELSE else Else
-syn keyword basicStatement INPUT input Input INPUT# input# Input#
-syn keyword basicStatement IOCTL ioctl Ioctl KEY key Key
-syn keyword basicStatement KILL kill Kill LET let Let
-syn keyword basicStatement LINE line Line LOCATE locate Locate
-syn keyword basicStatement LOCK lock Lock UNLOCK unlock Unlock
-syn keyword basicStatement LPRINT lprint Lprint USING using Using
-syn keyword basicStatement LSET lset Lset MKDIR mkdir Mkdir
-syn keyword basicStatement NAME name Name ON on On
-syn keyword basicStatement ERROR error Error OPEN open Open
-syn keyword basicStatement OPTION option Option BASE base Base
-syn keyword basicStatement OUT out Out PAINT paint Paint
-syn keyword basicStatement PALETTE palette Palette PCOPY pcopy Pcopy
-syn keyword basicStatement PEN pen Pen PLAY play Play
-syn keyword basicStatement PMAP pmap Pmap POKE poke Poke
-syn keyword basicStatement PRESET preset Preset PRINT print Print
-syn keyword basicStatement PRINT# print# Print# USING using Using
-syn keyword basicStatement PSET pset Pset PUT put Put
-syn keyword basicStatement RANDOMIZE randomize Randomize READ read Read
-syn keyword basicStatement REDIM redim Redim RESET reset Reset
-syn keyword basicStatement RESTORE restore Restore RESUME resume Resume
-syn keyword basicStatement RETURN return Return RMDIR rmdir Rmdir
-syn keyword basicStatement RSET rset Rset RUN run Run
-syn keyword basicStatement SEEK seek Seek SELECT select Select
-syn keyword basicStatement CASE case Case SHARED shared Shared
-syn keyword basicStatement SHELL shell Shell SLEEP sleep Sleep
-syn keyword basicStatement SOUND sound Sound STATIC static Static
-syn keyword basicStatement STOP stop Stop STRIG strig Strig
-syn keyword basicStatement SUB sub Sub SWAP swap Swap
-syn keyword basicStatement SYSTEM system System TIMER timer Timer
-syn keyword basicStatement TROFF troff Troff TRON tron Tron
-syn keyword basicStatement TYPE type Type UNLOCK unlock Unlock
-syn keyword basicStatement VIEW view View WAIT wait Wait
-syn keyword basicStatement WHILE while While WEND wend Wend
-syn keyword basicStatement WIDTH width Width WINDOW window Window
-syn keyword basicStatement WRITE write Write DATE$ date$ Date$
-syn keyword basicStatement MID$ mid$ Mid$ TIME$ time$ Time$
-
-syn keyword basicFunction ABS abs Abs ASC asc Asc
-syn keyword basicFunction ATN atn Atn CDBL cdbl Cdbl
-syn keyword basicFunction CINT cint Cint CLNG clng Clng
-syn keyword basicFunction COS cos Cos CSNG csng Csng
-syn keyword basicFunction CSRLIN csrlin Csrlin CVD cvd Cvd
-syn keyword basicFunction CVDMBF cvdmbf Cvdmbf CVI cvi Cvi
-syn keyword basicFunction CVL cvl Cvl CVS cvs Cvs
-syn keyword basicFunction CVSMBF cvsmbf Cvsmbf EOF eof Eof
-syn keyword basicFunction ERDEV erdev Erdev ERL erl Erl
-syn keyword basicFunction ERR err Err EXP exp Exp
-syn keyword basicFunction FILEATTR fileattr Fileattr FIX fix Fix
-syn keyword basicFunction FRE fre Fre FREEFILE freefile Freefile
-syn keyword basicFunction INP inp Inp INSTR instr Instr
-syn keyword basicFunction INT int Int LBOUND lbound Lbound
-syn keyword basicFunction LEN len Len LOC loc Loc
-syn keyword basicFunction LOF lof Lof LOG log Log
-syn keyword basicFunction LPOS lpos Lpos PEEK peek Peek
-syn keyword basicFunction PEN pen Pen POINT point Point
-syn keyword basicFunction POS pos Pos RND rnd Rnd
-syn keyword basicFunction SADD sadd Sadd SCREEN screen Screen
-syn keyword basicFunction SEEK seek Seek SETMEM setmem Setmem
-syn keyword basicFunction SGN sgn Sgn SIN sin Sin
-syn keyword basicFunction SPC spc Spc SQR sqr Sqr
-syn keyword basicFunction STICK stick Stick STRIG strig Strig
-syn keyword basicFunction TAB tab Tab TAN tan Tan
-syn keyword basicFunction UBOUND ubound Ubound VAL val Val
-syn keyword basicFunction VALPTR valptr Valptr VALSEG valseg Valseg
-syn keyword basicFunction VARPTR varptr Varptr VARSEG varseg Varseg
-syn keyword basicFunction CHR$ Chr$ chr$ COMMAND$ command$ Command$
-syn keyword basicFunction DATE$ date$ Date$ ENVIRON$ environ$ Environ$
-syn keyword basicFunction ERDEV$ erdev$ Erdev$ HEX$ hex$ Hex$
-syn keyword basicFunction INKEY$ inkey$ Inkey$ INPUT$ input$ Input$
-syn keyword basicFunction IOCTL$ ioctl$ Ioctl$ LCASES$ lcases$ Lcases$
-syn keyword basicFunction LAFT$ laft$ Laft$ LTRIM$ ltrim$ Ltrim$
-syn keyword basicFunction MID$ mid$ Mid$ MKDMBF$ mkdmbf$ Mkdmbf$
-syn keyword basicFunction MKD$ mkd$ Mkd$ MKI$ mki$ Mki$
-syn keyword basicFunction MKL$ mkl$ Mkl$ MKSMBF$ mksmbf$ Mksmbf$
-syn keyword basicFunction MKS$ mks$ Mks$ OCT$ oct$ Oct$
-syn keyword basicFunction RIGHT$ right$ Right$ RTRIM$ rtrim$ Rtrim$
-syn keyword basicFunction SPACE$ space$ Space$ STR$ str$ Str$
-syn keyword basicFunction STRING$ string$ String$ TIME$ time$ Time$
-syn keyword basicFunction UCASE$ ucase$ Ucase$ VARPTR$ varptr$ Varptr$
+let s:keywords =<< trim EOL " {{{2
+ absolute
+ access
+ alias
+ append
+ as
+ base
+ binary
+ byval
+ cdecl
+ com
+ def
+ do
+ for
+ function
+ gosub
+ goto
+ input
+ int86old
+ int86xold
+ interrupt
+ interruptx
+ is
+ key
+ len
+ list
+ local
+ lock
+ lprint
+ next
+ off
+ on
+ output
+ pen
+ play
+ random
+ read
+ resume
+ screen
+ seg
+ shared
+ signal
+ static
+ step
+ stop
+ strig
+ sub
+ timer
+ to
+ until
+ using
+ while
+ write
+EOL
+" }}}
+
+for k in s:keywords
+ exe 'syn match basicKeyword "\<' .. k .. '\>"'
+endfor
+
+" Functions {{{1
+syn keyword basicFunction abs asc atn cdbl chr$ cint clng command$ cos csng
+syn keyword basicFunction csrlin cvd cvdmbf cvi cvl cvs cvsmbf environ$ eof
+syn keyword basicFunction erdev erdev$ erl err exp fileattr fix fre freefile
+syn keyword basicFunction hex$ inkey$ inp input$ instr int ioctl$ left$ lbound
+syn keyword basicFunction lcase$ len loc lof log lpos ltrim$ mkd$ mkdmbf$ mki$
+syn keyword basicFunction mkl$ mks$ mksmbf$ oct$ peek pen point pos right$ rnd
+syn keyword basicFunction rtrim$ sadd setmem sgn sin space$ spc sqr stick str$
+syn keyword basicFunction strig string$ tab tan ubound ucase$ val valptr
+syn keyword basicFunction valseg varptr varptr$ varseg
+
+" Functions and statements (same name) {{{1
+syn match basicStatement "\<\%(date\$\|mid\$\|play\|screen\|seek\|time\$\|timer\)\>" contained
+syn match basicFunction "\<\%(date\$\|mid\$\|play\|screen\|seek\|time\$\|timer\)\>"
+
+" Types {{{1
+syn keyword basicType integer long single double string any
+
+" Strings {{{1
+
+" Unquoted DATA strings - anything except [:,] and leading or trailing whitespace
+" Needs lower priority than numbers
+syn match basicDataString "[^[:space:],:]\+\%(\s\+[^[:space:],:]\+\)*" contained
+
+syn region basicString start=+"+ end=+"+ oneline
+
+" Booleans {{{1
+if exists("basic_booleans")
+ syn keyword basicBoolean true false
+endif
" Numbers {{{1
-" Integer number, or floating point number without a dot.
-syn match basicNumber "\<\d\+\>"
-" Floating point number, with dot
-syn match basicNumber "\<\d\+\.\d*\>"
-" Floating point number, starting with a dot
-syn match basicNumber "\.\d\+\>"
-" String and Character constants {{{1
-syn match basicSpecial "\\\d\d\d\|\\." contained
-syn region basicString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=basicSpecial
+" Integers
+syn match basicNumber "-\=&o\=\o\+[%&]\=\>"
+syn match basicNumber "-\=&h\x\+[%&]\=\>"
+syn match basicNumber "-\=\<\d\+[%&]\=\>"
+
+" Floats
+syn match basicFloat "-\=\<\d\+\.\=\d*\%(\%([ed][+-]\=\d*\)\|[!#]\)\=\>"
+syn match basicFloat "-\=\<\.\d\+\%(\%([ed][+-]\=\d*\)\|[!#]\)\=\>"
-" Line numbers {{{1
-syn region basicLineNumber start="^\d" end="\s"
+" Statement anchors {{{1
+syn match basicLineStart "^" nextgroup=@basicStatements,@basicLineIdentifier skipwhite
+syn match basicStatementSeparator ":" nextgroup=@basicStatements skipwhite
-" Data-type suffixes {{{1
-syn match basicTypeSpecifier "[a-zA-Z0-9][$%&!#]"ms=s+1
-" Used with OPEN statement
-syn match basicFilenumber "#\d\+"
+" Line numbers and labels {{{1
+
+" QuickBASIC limits these to 65,529 and 40 chars respectively
+syn match basicLineNumber "\d\+" nextgroup=@basicStatements skipwhite contained
+syn match basicLineLabel "\a[[:alnum:]]*\ze\s*:" nextgroup=@basicStatements skipwhite contained
+
+syn cluster basicLineIdentifier contains=basicLineNumber,basicLineLabel
+
+" Line Continuation {{{1
+syn match basicLineContinuation "\s*\zs_\ze\s*$"
+
+" Type suffixes {{{1
+if exists("basic_type_suffixes")
+ syn match basicTypeSuffix "\a[[:alnum:].]*\zs[$%&!#]"
+endif
-" Mathematical operators {{{1
-" syn match basicMathsOperator "[<>+\*^/\\=-]"
-syn match basicMathsOperator "-\|=\|[:<>+\*^/\\]\|AND\|OR"
+" File numbers {{{1
+syn match basicFilenumber "#\d\+"
+syn match basicFilenumber "#\a[[:alnum:].]*[%&!#]\="
+
+" Operators {{{1
+if exists("basic_operators")
+ syn match basicArithmeticOperator "[-+*/\\^]"
+ syn match basicRelationalOperator "<>\|<=\|>=\|[><=]"
+endif
+syn match basicLogicalOperator "\<\%(not\|and\|or\|xor\|eqv\|imp\)\>"
+syn match basicArithmeticOperator "\<mod\>"
+
+" Metacommands {{{1
+" Note: No trailing word boundaries. Text may be freely mixed however there
+" must be only leading whitespace prior to the first metacommand
+syn match basicMetacommand "$INCLUDE\s*:\s*'[^']\+'" contained containedin=@basicMetaComments
+syn match basicMetacommand "$\%(DYNAMIC\|STATIC\)" contained containedin=@basicMetaComments
" Comments {{{1
-syn keyword basicTodo TODO FIXME XXX NOTE contained
-syn region basicComment start="^\s*\zsREM\>" start="\%(:\s*\)\@<=REM\>" end="$" contains=basicTodo
-syn region basicComment start="'" end="$" contains=basicTodo
+syn keyword basicTodo TODO FIXME XXX NOTE contained
+
+syn region basicRemStatement matchgroup=basicStatement start="REM\>" end="$" contains=basicTodo,@Spell contained
+syn region basicComment start="'" end="$" contains=basicTodo,@Spell
+
+if !exists("basic_no_comment_fold")
+ syn region basicMultilineComment start="^\s*'.*\n\%(\s*'\)\@=" end="^\s*'.*\n\%(\s*'\)\@!" contains=@basicComments transparent fold keepend
+endif
+
+" Metacommands
+syn region basicMetaRemStatement matchgroup=basicStatement start="REM\>\s*\$\@=" end="$" contains=basicTodo contained
+syn region basicMetaComment start="'\s*\$\@=" end="$" contains=basicTodo
+
+syn cluster basicMetaComments contains=basicMetaComment,basicMetaRemStatement
+syn cluster basicComments contains=basicComment,basicMetaComment
"syn sync ccomment basicComment
" Default Highlighting {{{1
-hi def link basicLabel Label
-hi def link basicConditional Conditional
-hi def link basicRepeat Repeat
-hi def link basicLineNumber Comment
-hi def link basicNumber Number
-hi def link basicError Error
-hi def link basicStatement Statement
-hi def link basicString String
-hi def link basicComment Comment
-hi def link basicSpecial Special
-hi def link basicTodo Todo
-hi def link basicFunction Identifier
-hi def link basicTypeSpecifier Type
-hi def link basicFilenumber basicTypeSpecifier
-"hi basicMathsOperator term=bold cterm=bold gui=bold
+hi def link basicArithmeticOperator basicOperator
+hi def link basicBoolean Boolean
+hi def link basicComment Comment
+hi def link basicCommentError Error
+hi def link basicDataString basicString
+hi def link basicFilenumber basicTypeSuffix " TODO: better group
+hi def link basicFloat Float
+hi def link basicFunction Identifier
+hi def link basicKeyword Keyword
+hi def link basicLineIdentifier LineNr
+hi def link basicLineContinuation Special
+hi def link basicLineLabel basicLineIdentifier
+hi def link basicLineNumber basicLineIdentifier
+hi def link basicLogicalOperator basicOperator
+hi def link basicMetacommand SpecialComment
+hi def link basicMetaComment Comment
+hi def link basicMetaRemStatement Comment
+hi def link basicNumber Number
+hi def link basicOperator Operator
+hi def link basicPutAction Keyword
+hi def link basicRelationalOperator basicOperator
+hi def link basicRemStatement Comment
+hi def link basicSpaceError Error
+hi def link basicStatementSeparator Special
+hi def link basicStatement Statement
+hi def link basicString String
+hi def link basicTodo Todo
+hi def link basicType Type
+hi def link basicTypeSuffix Special
+if exists("basic_legacy_syntax_groups")
+ hi def link basicTypeSpecifier Type
+ hi def link basicTypeSuffix basicTypeSpecifier
+endif
" Postscript {{{1
let b:current_syntax = "basic"
diff --git a/runtime/syntax/qb64.vim b/runtime/syntax/qb64.vim
new file mode 100644
index 0000000000..a777e14481
--- /dev/null
+++ b/runtime/syntax/qb64.vim
@@ -0,0 +1,409 @@
+" Vim syntax file
+" Language: QB64
+" Maintainer: Doug Kearns <dougkearns@gmail.com>
+" Last Change: 2022 Jan 21
+
+" Prelude {{{1
+if exists("b:current_syntax")
+ finish
+endif
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+" syn iskeyword set after sourcing of basic.vim
+
+syn case ignore
+
+let s:prefix = search('\c^\s*$NOPREFIX\>', 'n') ? '_\=' : '_'
+
+" Statements {{{1
+
+let s:statements =<< trim EOL " {{{2
+ acceptfiledrop
+ allowfullscreen
+ assert
+ console
+ consolecursor
+ consolefont
+ consoletitle
+ continue
+ copypalette
+ define
+ delay
+ depthbuffer
+ displayorder
+ dontblend
+ echo
+ exit\s\+\%(select\|case\)
+ finishdrop
+ freefont
+ freeimage
+ icon
+ keyclear
+ limit
+ maptriangle
+ memcopy
+ memfill
+ memfree
+ memput
+ mousehide
+ mousemove
+ mouseshow
+ printimage
+ printstring
+ putimage
+ screenclick
+ screenhide
+ screenmove
+ screenprint
+ screenshow
+ setalpha
+ sndbal
+ sndclose
+ sndlimit
+ sndloop
+ sndpause
+ sndplay
+ sndplaycopy
+ sndplayfile
+ sndraw
+ sndrawdone
+ sndsetpos
+ sndstop
+ sndvol
+ title
+EOL
+" }}}
+
+for s in s:statements
+ exe 'syn match qb64Statement "\<' .. s:prefix .. s .. '\>" contained contains=qb64Underscore'
+endfor
+
+" Functions {{{1
+
+let s:functions =<< trim EOL " {{{2
+ acos
+ acosh
+ alpha
+ alpha32
+ arccot
+ arccsc
+ arcsec
+ asin
+ asinh
+ atan2
+ atanh
+ axis
+ backgroundcolor
+ blue
+ blue32
+ button
+ buttonchange
+ ceil
+ cinp
+ commandcount
+ connected
+ connectionaddress
+ connectionaddress$
+ consoleinput
+ copyimage
+ cot
+ coth
+ cosh
+ csc
+ csch
+ cv
+ cwd$
+ d2g
+ d2r
+ defaultcolor
+ deflate$
+ desktopheight
+ desktopwidth
+ device$
+ deviceinput
+ devices
+ dir$
+ direxists
+ droppedfile
+ droppedfile$
+ errorline
+ errormessage$
+ exit
+ fileexists
+ fontheight
+ fontwidth
+ freetimer
+ g2d
+ g2r
+ green
+ green32
+ height
+ hypot
+ inclerrorfile$
+ inclerrorline
+ inflate$
+ instrrev
+ keyhit
+ keydown
+ lastaxis
+ lastbutton
+ lastwheel
+ loadfont
+ loadimage
+ mem
+ memelement
+ memexists
+ memimage
+ memnew
+ memsound
+ mk$
+ mousebutton
+ mouseinput
+ mousemovementx
+ mousemovementy
+ mousepipeopen
+ mousewheel
+ mousex
+ mousey
+ newimage
+ offset
+ openclient
+ os$
+ pi
+ pixelsize
+ printwidth
+ r2d
+ r2g
+ red
+ red32
+ readbit
+ resetbit
+ resizeheight
+ resizewidth
+ rgb
+ rgb32
+ rgba
+ rgba32
+ round
+ sec
+ sech
+ screenexists
+ screenimage
+ screenx
+ screeny
+ setbit
+ shellhide
+ shl
+ shr
+ sinh
+ sndcopy
+ sndgetpos
+ sndlen
+ sndopen
+ sndopenraw
+ sndpaused
+ sndplaying
+ sndrate
+ sndrawlen
+ startdir$
+ strcmp
+ stricmp
+ tanh
+ title$
+ togglebit
+ totaldroppedfiles
+ trim$
+ wheel
+ width
+ windowhandle
+ windowhasfocus
+EOL
+" }}}
+
+for f in s:functions
+ exe 'syn match qb64Function "\<' .. s:prefix .. f .. '\>" contains=qb64Underscore'
+endfor
+
+" Functions and statements (same name) {{{1
+
+let s:common =<< trim EOL " {{{2
+ autodisplay
+ blend
+ blink
+ capslock
+ clearcolor
+ clipboard$
+ clipboardimage
+ controlchr
+ dest
+ display
+ font
+ fullscreen
+ mapunicode
+ memget
+ numlock
+ palettecolor
+ printmode
+ resize
+ screenicon
+ scrolllock
+ source
+EOL
+" }}}
+
+for c in s:common
+ exe 'syn match qb64Statement "\<' .. s:prefix .. c .. '\>" contains=qb64Underscore contained'
+ exe 'syn match qb64Function "\<' .. s:prefix .. c .. '\>" contains=qb64Underscore'
+endfor
+
+" Keywords {{{1
+
+" Non-prefixed keywords {{{2
+" TIMER FREE
+" _DEPTH_BUFFER LOCK
+syn keyword qb64Keyword free lock
+
+let s:keywords =<< trim EOL " {{{2
+ all
+ anticlockwise
+ behind
+ clear
+ clip
+ console
+ dontwait
+ explicit
+ explicitarray
+ fillbackground
+ hardware
+ hardware1
+ hide
+ keepbackground
+ middle
+ none
+ off
+ only
+ onlybackground
+ ontop
+ openconnection
+ openhost
+ preserve
+ seamless
+ smooth
+ smoothshrunk
+ smoothstretched
+ software
+ squarepixels
+ stretch
+ toggle
+EOL
+" }}}
+
+for k in s:keywords
+ exe 'syn match qb64Keyword "\<' .. s:prefix .. k .. '\>" contains=qb64Underscore'
+endfor
+
+syn match qb64Underscore "\<_" contained conceal transparent
+
+" Source QuickBASIC syntax {{{1
+runtime! syntax/basic.vim
+
+" add after the BASIC syntax file is sourced so cluster already exists
+syn cluster basicStatements add=qb64Statement,qb64Metacommand,qb64IfMetacommand
+syn cluster basicLineIdentifier add=qb64LineLabel
+syn cluster qb64NotTop contains=@basicNotTop,qb64Metavariable
+
+syn iskeyword @,48-57,.,_,!,#,$,%,&,`
+
+" Unsupported QuickBASIC features {{{1
+" TODO: add linux only missing features
+syn keyword qb64Unsupported alias any byval calls cdecl erdev erdev$ fileattr
+syn keyword qb64Unsupported fre ioctl ioctl$ pen play setmem signal uevent
+syn keyword qb64Unsupported tron troff
+syn match qb64Unsupported "\<declare\%(\s\+\%(sub\|function\)\>\)\@="
+syn match qb64Unsupported "\<\%(date\|time\)$\ze\s*=" " statements only
+syn match qb64Unsupported "\<def\zs\s\+FN"
+syn match qb64Unsupported "\<\%(exit\|end\)\s\+def\>"
+syn match qb64Unsupported "\<width\s\+lprint\>"
+
+" Types {{{1
+syn keyword qb64Type _BIT _BYTE _FLOAT _INTEGER64 _MEM _OFFSET _UNSIGNED
+
+" Type suffixes {{{1
+if exists("basic_type_suffixes")
+ " TODO: handle leading word boundary and __+ prefix
+ syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=\~\=`\%(\d\+\)\="
+ syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=\~\=\%(%\|%%\|&\|&&\|%&\)"
+ syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=\%(!\|##\|#\)"
+ syn match qb64TypeSuffix "\%(\a[[:alnum:]._]*\)\@<=$\%(\d\+\)\="
+endif
+
+" Numbers {{{1
+
+" Integers
+syn match qb64Number "-\=&b[01]\+&\>\="
+
+syn match qb64Number "-\=\<[01]\~\=`\>"
+syn match qb64Number "-\=\<\d\+`\d\+\>"
+
+syn match qb64Number "-\=\<\d\+\%(%%\|&&\|%&\)\>"
+syn match qb64Number "\<\d\+\~\%(%%\|&&\|%&\)\>"
+
+syn match qb64Number "-\=\<&b[01]\+\%(%%\|&&\|%&\)\>"
+syn match qb64Number "\<&b[01]\+\~\%(%%\|&&\|%&\)\>"
+
+syn match qb64Number "-\=\<&o\=\o\+\%(%%\|&&\|%&\)\>"
+syn match qb64Number "\<&o\=\o\+\~\%(%%\|&&\|%&\)\>"
+
+syn match qb64Number "-\=\<&h\x\+\%(%%\|&&\|%&\)\>"
+syn match qb64Number "\<&h\x\+\~\%(%%\|&&\|%&\)\>"
+
+" Floats
+syn match qb64Float "-\=\<\d\+\.\=\d*##\>"
+syn match qb64Float "-\=\<\.\d\+##\>"
+
+" Line numbers and labels {{{1
+syn match qb64LineLabel "\%(_\{2,}\)\=\a[[:alnum:]._]*[[:alnum:]]\ze\s*:" nextgroup=@basicStatements skipwhite contained
+
+" Metacommands {{{1
+syn match qb64Metacommand contained "$NOPREFIX\>"
+syn match qb64Metacommand contained "$ASSERTS\%(:CONSOLE\)\=\>"
+syn match qb64Metacommand contained "$CHECKING:\%(ON\|OFF\)\>"
+syn match qb64Metacommand contained "$COLOR:\%(0\|32\)\>"
+syn match qb64Metacommand contained "$CONSOLE\%(:ONLY\)\=\>"
+syn match qb64Metacommand contained "$EXEICON\s*:\s*'[^']\+'"
+syn match qb64Metacommand contained "$ERROR\>"
+syn match qb64Metacommand contained "$LET\>"
+syn match qb64Metacommand contained "$RESIZE:\%(ON\|OFF\|STRETCH\|SMOOTH\)\>"
+syn match qb64Metacommand contained "$SCREEN\%(HIDE\|SHOW\)\>"
+syn match qb64Metacommand contained "$VERSIONINFO\s*:.*"
+syn match qb64Metacommand contained "$VIRTUALKEYBOARD:\%(ON\|OFF\)\>"
+
+syn region qb64IfMetacommand contained matchgroup=qb64Metacommand start="$\%(IF\|ELSEIF\)\>" end="\<THEN\>" oneline transparent contains=qb64Metavariable
+syn match qb64Metacommand contained "$\%(ELSE\|END\s*IF\)\>"
+
+syn keyword qb64Metavariable contained defined undefined
+syn keyword qb64Metavariable contained windows win linux mac maxosx
+syn keyword qb64Metavariable contained 32bit 64bit version
+
+" Default Highlighting {{{1
+hi def link qb64Float basicFloat
+hi def link qb64Function Function
+hi def link qb64Keyword Keyword
+hi def link qb64LineLabel basicLineLabel
+hi def link qb64Metacommand PreProc
+hi def link qb64Metavariable Identifier
+hi def link qb64Number basicNumber
+hi def link qb64Statement Statement
+hi def link qb64TypeSuffix basicTypeSuffix
+hi def link qb64Type Type
+hi def link qb64Unsupported Error
+
+" Postscript {{{1
+let b:current_syntax = "qb64"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker:
diff --git a/runtime/syntax/strace.vim b/runtime/syntax/strace.vim
index 206c58919e..20516a1853 100644
--- a/runtime/syntax/strace.vim
+++ b/runtime/syntax/strace.vim
@@ -1,8 +1,7 @@
" Vim syntax file
-" This is a GENERATED FILE. Please always refer to source file at the URI below.
" Language: strace output
" Maintainer: David Necas (Yeti) <yeti@physics.muni.cz>
-" Last Change: 2015-01-16
+" Last Change: 2022 Jan 29
" Setup
" quit when a syntax file was already loaded
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index eee5a0b46c..52a7db3be2 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1899,10 +1899,8 @@ void free_buf_options(buf_T *buf, int free_p_ff)
clear_string_option(&buf->b_p_flp);
clear_string_option(&buf->b_p_isk);
clear_string_option(&buf->b_p_vsts);
- xfree(buf->b_p_vsts_nopaste);
- buf->b_p_vsts_nopaste = NULL;
- xfree(buf->b_p_vsts_array);
- buf->b_p_vsts_array = NULL;
+ XFREE_CLEAR(buf->b_p_vsts_nopaste);
+ XFREE_CLEAR(buf->b_p_vsts_array);
clear_string_option(&buf->b_p_vts);
XFREE_CLEAR(buf->b_p_vts_array);
clear_string_option(&buf->b_p_keymap);
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index cf3322df1b..b8e9f41551 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -11004,10 +11004,7 @@ typval_T eval_call_provider(char *provider, char *method, list_T *arguments, boo
bool eval_has_provider(const char *feat)
{
if (!strequal(feat, "clipboard")
- && !strequal(feat, "python")
&& !strequal(feat, "python3")
- && !strequal(feat, "python_compiled")
- && !strequal(feat, "python_dynamic")
&& !strequal(feat, "python3_compiled")
&& !strequal(feat, "python3_dynamic")
&& !strequal(feat, "perl")
diff --git a/src/nvim/keymap.h b/src/nvim/keymap.h
index 42cae0c35e..ae2ec7835e 100644
--- a/src/nvim/keymap.h
+++ b/src/nvim/keymap.h
@@ -122,8 +122,6 @@
//
// Entries must be in the range 0x02-0x7f (see comment at K_SPECIAL).
enum key_extra {
- KE_NAME = 3, // name of this terminal entry
-
KE_S_UP = 4, // shift-up
KE_S_DOWN = 5, // shift-down
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 2fb1966cda..80dde2eda6 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3178,10 +3178,7 @@ ambw_end:
char_u *cp;
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
- if (curbuf->b_p_vsts_array) {
- xfree(curbuf->b_p_vsts_array);
- curbuf->b_p_vsts_array = 0;
- }
+ XFREE_CLEAR(curbuf->b_p_vsts_array);
} else {
for (cp = *varp; *cp; cp++) {
if (ascii_isdigit(*cp)) {
@@ -3206,10 +3203,7 @@ ambw_end:
char_u *cp;
if (!(*varp)[0] || ((*varp)[0] == '0' && !(*varp)[1])) {
- if (curbuf->b_p_vts_array) {
- xfree(curbuf->b_p_vts_array);
- curbuf->b_p_vts_array = NULL;
- }
+ XFREE_CLEAR(curbuf->b_p_vts_array);
} else {
for (cp = *varp; *cp; cp++) {
if (ascii_isdigit(*cp)) {
@@ -4420,6 +4414,8 @@ static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf,
} else if (pp == &curbuf->b_p_ts || pp == &p_ts) {
if (value < 1) {
errmsg = e_positive;
+ } else if (value > TABSTOP_MAX) {
+ errmsg = e_invarg;
}
} else if (pp == &curbuf->b_p_tw || pp == &p_tw) {
if (value < 0) {
@@ -6416,7 +6412,7 @@ void buf_copy_options(buf_T *buf, int flags)
if (p_vsts && p_vsts != empty_option) {
(void)tabstop_set(p_vsts, &buf->b_p_vsts_array);
} else {
- buf->b_p_vsts_array = 0;
+ buf->b_p_vsts_array = NULL;
}
buf->b_p_vsts_nopaste = p_vsts_nopaste
? vim_strsave(p_vsts_nopaste)
@@ -7153,10 +7149,7 @@ static void paste_option_changed(void)
free_string_option(buf->b_p_vsts);
}
buf->b_p_vsts = empty_option;
- if (buf->b_p_vsts_array) {
- xfree(buf->b_p_vsts_array);
- }
- buf->b_p_vsts_array = 0;
+ XFREE_CLEAR(buf->b_p_vsts_array);
}
// set global options
@@ -7193,13 +7186,11 @@ static void paste_option_changed(void)
buf->b_p_vsts = buf->b_p_vsts_nopaste
? vim_strsave(buf->b_p_vsts_nopaste)
: empty_option;
- if (buf->b_p_vsts_array) {
- xfree(buf->b_p_vsts_array);
- }
+ xfree(buf->b_p_vsts_array);
if (buf->b_p_vsts && buf->b_p_vsts != empty_option) {
(void)tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array);
} else {
- buf->b_p_vsts_array = 0;
+ buf->b_p_vsts_array = NULL;
}
}
@@ -7560,7 +7551,7 @@ bool tabstop_set(char_u *var, long **array)
int n = atoi((char *)cp);
// Catch negative values, overflow and ridiculous big values.
- if (n < 0 || n > 9999) {
+ if (n < 0 || n > TABSTOP_MAX) {
semsg(_(e_invarg2), cp);
XFREE_CLEAR(*array);
return false;
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 5d6aca9574..d88cd6b9b9 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -903,6 +903,8 @@ enum {
#define SB_MAX 100000 // Maximum 'scrollback' value.
+#define TABSTOP_MAX 9999
+
/// Stores an identifier of a script or channel that last set an option.
typedef struct {
sctx_T script_ctx; /// script context where the option was last set
diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim
index 2312df5450..f7bfa48943 100644
--- a/src/nvim/testdir/test_options.vim
+++ b/src/nvim/testdir/test_options.vim
@@ -259,6 +259,8 @@ func Test_set_errors()
call assert_fails('set shiftwidth=-1', 'E487:')
call assert_fails('set sidescroll=-1', 'E487:')
call assert_fails('set tabstop=-1', 'E487:')
+ call assert_fails('set tabstop=10000', 'E474:')
+ call assert_fails('set tabstop=5500000000', 'E474:')
call assert_fails('set textwidth=-1', 'E487:')
call assert_fails('set timeoutlen=-1', 'E487:')
call assert_fails('set updatecount=-1', 'E487:')
diff --git a/test/functional/fixtures/autoload/provider/python.vim b/test/functional/fixtures/autoload/provider/python3.vim
index d68360ac30..8ed4330a35 100644
--- a/test/functional/fixtures/autoload/provider/python.vim
+++ b/test/functional/fixtures/autoload/provider/python3.vim
@@ -1,6 +1,6 @@
" Dummy test provider, missing this required variable:
" let g:loaded_brokenenabled_provider = 0
-function! provider#python#Call(method, args)
+function! provider#python3#Call(method, args)
return 42
endfunction
diff --git a/test/functional/provider/provider_spec.lua b/test/functional/provider/provider_spec.lua
index 78bc4a4edb..3895b8613f 100644
--- a/test/functional/provider/provider_spec.lua
+++ b/test/functional/provider/provider_spec.lua
@@ -14,8 +14,8 @@ describe('providers', function()
command('set loadplugins')
-- Using test-fixture with broken impl:
-- test/functional/fixtures/autoload/provider/python.vim
- eq('Vim:provider: python: missing required variable g:loaded_python_provider',
- pcall_err(eval, "has('python')"))
+ eq('Vim:provider: python3: missing required variable g:loaded_python3_provider',
+ pcall_err(eval, "has('python3')"))
end)
it('with g:loaded_xx_provider, missing #Call()', function()