vim-patch:9.1.1286: filetype: help files not detected when 'iskeyword' includes ":" (#33377)

Problem:  Help files not detected when 'iskeyword' includes ":".
Solution: Do not use \< and \> in the pattern (zeertzjq).

fixes: vim/vim#17069
closes: vim/vim#17071

e370141bf4
(cherry picked from commit 8af9f8ab5e)
This commit is contained in:
zeertzjq
2025-04-08 08:13:12 +08:00
committed by github-actions[bot]
parent 6e51d39696
commit a92155b86b
2 changed files with 42 additions and 8 deletions

View File

@@ -2427,8 +2427,26 @@ local pattern = {
['^%.?gtkrc'] = starsetf('gtkrc'),
['/doc/.*%.txt$'] = function(_, bufnr)
local line = M._getline(bufnr, -1)
local ml = line:find('^vim:') or line:find('%svim:')
if ml and M._matchregex(line:sub(ml), [[\<\(ft\|filetype\)=help\>]]) then
if
M._findany(line, {
'^vim:ft=help[:%s]',
'^vim:ft=help$',
'^vim:filetype=help[:%s]',
'^vim:filetype=help$',
'^vim:.*[:%s]ft=help[:%s]',
'^vim:.*[:%s]ft=help$',
'^vim:.*[:%s]filetype=help[:%s]',
'^vim:.*[:%s]filetype=help$',
'%svim:ft=help[:%s]',
'%svim:ft=help$',
'%svim:filetype=help[:%s]',
'%svim:filetype=help$',
'%svim:.*[:%s]ft=help[:%s]',
'%svim:.*[:%s]ft=help$',
'%svim:.*[:%s]filetype=help[:%s]',
'%svim:.*[:%s]filetype=help$',
})
then
return 'help'
end
end,