aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-05-27 07:12:53 +0800
committerGitHub <noreply@github.com>2026-05-27 07:12:53 +0800
commitb3dfa86e02b0ce0f3ef9bc7b90dbbd790e7da31e (patch)
treec3956f5ed2f15a5333ee7757b4b14acc97980104 /runtime/lua/vim
parentd214c24129f0f63c8c1739d655595565a6d4d059 (diff)
downloadrneovim-b3dfa86e02b0ce0f3ef9bc7b90dbbd790e7da31e.tar.gz
rneovim-b3dfa86e02b0ce0f3ef9bc7b90dbbd790e7da31e.tar.bz2
rneovim-b3dfa86e02b0ce0f3ef9bc7b90dbbd790e7da31e.zip
vim-patch:9.2.0539: filetype: too many Bitbake include files are recognized (#40014)
Problem: filetype: too many Bitbake include files are recognized (Brahmajit Das, after v9.1.1732) Solution: Tighten the pattern to detect BitBake include files, update tests (Martin Schwan). Be more strict when detecting BitBake inc files. In particular, only match include keywords and variable assignments at the beginning of a line (excluding whitespace). Use non-capturing groups to slightly improve performance. Use regex or-operators to exactly match BitBake assignment operators. The previous expression would falsely match FOO .=. "bar" , which is not valid BitBake syntax. The new capturing group is more specific and matches only valid assignments. fixes: vim/vim#20288 closes: vim/vim#20335 https://github.com/vim/vim/commit/2df68c8e4bc03a5222218e22e74897861b8c1896 Co-authored-by: Martin Schwan <m.schwan@phytec.de>
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/filetype/detect.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 79cc6651c4..49739dba4f 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -936,10 +936,10 @@ function M.inc(path, bufnr)
elseif findany(line, { '^%s{', '^%s%(%*' }) or matchregex(line, pascal_keywords) then
return 'pascal'
elseif
- matchregex(line, [[\<\%(require\|inherit\)\>]])
+ matchregex(line, [[^\s*\<\%(require\|inherit\)\>]])
or matchregex(
line,
- [=[[A-Z][A-Za-z0-9_:${}/]*\(\[[A-Za-z0-9_:/]\+\]\)*\s\+\%(??\|[?:+.]\)\?=.\? ]=]
+ [=[^\s*[A-Z][A-Za-z0-9_:${}/]*\%(\[[A-Za-z0-9_:/]\+\]\)*\s\+\%(??=\|[?:+.]=\|=[+.]\?\)\s\+]=]
)
then
return 'bitbake'