aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/filetype.lua12
-rw-r--r--runtime/lua/vim/filetype/detect.lua31
2 files changed, 29 insertions, 14 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 35a10b6bdc..0e8ecf1b07 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -351,6 +351,7 @@ local extension = {
bat = 'dosbatch',
wrap = 'dosini',
ini = 'dosini',
+ vbp = 'dosini',
dot = 'dot',
gv = 'dot',
drac = 'dracula',
@@ -1025,13 +1026,18 @@ local extension = {
url = 'urlshortcut',
usd = 'usd',
usda = 'usd',
+ v = detect.v,
vsh = 'v',
vv = 'v',
+ ctl = 'vb',
+ dob = 'vb',
+ dsm = 'vb',
+ dsr = 'vb',
+ pag = 'vb',
sba = 'vb',
vb = 'vb',
- dsm = 'vb',
- ctl = 'vb',
vbs = 'vb',
+ vba = detect.vba,
vdf = 'vdf',
vdmpp = 'vdmpp',
vpp = 'vdmpp',
@@ -1041,7 +1047,6 @@ local extension = {
vr = 'vera',
vri = 'vera',
vrh = 'vera',
- v = detect.v,
va = 'verilogams',
vams = 'verilogams',
vhdl = 'vhdl',
@@ -1052,7 +1057,6 @@ local extension = {
vbe = 'vhdl',
tape = 'vhs',
vim = 'vim',
- vba = 'vim',
mar = 'vmasm',
cm = 'voscm',
wrl = 'vrml',
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index af6d77ecbf..0609ac5513 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -77,7 +77,7 @@ function M.asm_syntax(_, bufnr)
end
local visual_basic_content =
- { 'vb_name', 'begin vb%.form', 'begin vb%.mdiform', 'begin vb%.usercontrol' }
+ [[\c^\s*\%(Attribute\s\+VB_Name\|Begin\s\+\%(VB\.\|{\%(\x\+-\)\+\x\+}\)\)]]
-- See frm() for Visual Basic form file detection
--- @type vim.filetype.mapfn
@@ -97,7 +97,7 @@ function M.bas(_, bufnr)
local qb64_preproc = [[\c^\s*\%($\a\+\|option\s\+\%(_explicit\|_\=explicitarray\)\>\)]]
for _, line in ipairs(getlines(bufnr, 1, 100)) do
- if findany(line:lower(), visual_basic_content) then
+ if matchregex(line, visual_basic_content) then
return 'vb'
elseif
line:find(fb_comment)
@@ -193,12 +193,12 @@ function M.cls(_, bufnr)
if vim.g.filetype_cls then
return vim.g.filetype_cls
end
- local line = getline(bufnr, 1)
- if line:find('^[%%\\]') then
+ local line1 = getline(bufnr, 1)
+ if line1:find('^[%%\\]') then
return 'tex'
- elseif line:find('^#') and line:lower():find('rexx') then
+ elseif line1:find('^#') and line1:lower():find('rexx') then
return 'rexx'
- elseif line == 'VERSION 1.0 CLASS' then
+ elseif line1 == 'VERSION 1.0 CLASS' then
return 'vb'
end
return 'st'
@@ -525,12 +525,15 @@ function M.frm(_, bufnr)
if vim.g.filetype_frm then
return vim.g.filetype_frm
end
- local lines = table.concat(getlines(bufnr, 1, 5)):lower()
- if findany(lines, visual_basic_content) then
+ if getline(bufnr, 1) == 'VERSION 5.00' then
return 'vb'
- else
- return 'form'
end
+ for _, line in ipairs(getlines(bufnr, 1, 5)) do
+ if matchregex(line, visual_basic_content) then
+ return 'vb'
+ end
+ end
+ return 'form'
end
--- @type vim.filetype.mapfn
@@ -1529,6 +1532,14 @@ function M.v(_, bufnr)
return 'v'
end
+--- @type vim.filetype.mapfn
+function M.vba(_, bufnr)
+ if getline(bufnr, 1):find('^["#] Vimball Archiver') then
+ return 'vim'
+ end
+ return 'vb'
+end
+
-- WEB (*.web is also used for Winbatch: Guess, based on expecting "%" comment
-- lines in a WEB file).
--- @type vim.filetype.mapfn