aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-08-31 08:20:00 +0800
committerGitHub <noreply@github.com>2023-08-31 08:20:00 +0800
commit5d49542b561e7f4826e28f7a0aeca94d47b3e0b7 (patch)
tree133f090e5d8f5e21397eb4bc2af50932be5b7c56 /runtime/lua/vim
parent79148813567909aae8bc733e585d7713f6069401 (diff)
downloadrneovim-5d49542b561e7f4826e28f7a0aeca94d47b3e0b7.tar.gz
rneovim-5d49542b561e7f4826e28f7a0aeca94d47b3e0b7.tar.bz2
rneovim-5d49542b561e7f4826e28f7a0aeca94d47b3e0b7.zip
vim-patch:9.0.1820: Rexx files may not be recognised (#24956)
Problem: Rexx files may not be recognised Solution: Add shebang detection and improve disambiguation of *.cls files closes: vim/vim#12951 https://github.com/vim/vim/commit/e06afb7860805537ccd69966bc03169852c9b378 Co-authored-by: Doug Kearns <dougkearns@gmail.com>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/filetype/detect.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 0609ac5513..934b02dcdd 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -194,13 +194,18 @@ function M.cls(_, bufnr)
return vim.g.filetype_cls
end
local line1 = getline(bufnr, 1)
- if line1:find('^[%%\\]') then
- return 'tex'
- elseif line1:find('^#') and line1:lower():find('rexx') then
+ if matchregex(line1, [[^#!.*\<\%(rexx\|regina\)\>]]) then
return 'rexx'
elseif line1 == 'VERSION 1.0 CLASS' then
return 'vb'
end
+
+ local nonblank1 = nextnonblank(bufnr, 1)
+ if nonblank1 and nonblank1:find('^[%%\\]') then
+ return 'tex'
+ elseif nonblank1 and findany(nonblank1, { '^%s*/%*', '^%s*::%w' }) then
+ return 'rexx'
+ end
return 'st'
end
@@ -1648,6 +1653,7 @@ local patterns_hashbang = {
guile = 'scheme',
['nix%-shell'] = 'nix',
['crystal\\>'] = { 'crystal', { vim_regex = true } },
+ ['^\\%(rexx\\|regina\\)\\>'] = { 'rexx', { vim_regex = true } },
}
---@private