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

@@ -1628,20 +1628,36 @@ func Test_haredoc_file()
endfunc
func Test_help_file()
func! s:Check_help_with_iskeyword(fname)
exe 'split' a:fname
call assert_equal('help', &filetype)
bwipe!
set iskeyword+=:
exe 'split' a:fname
call assert_equal('help', &filetype)
bwipe!
set iskeyword&
endfunc
set nomodeline
filetype on
call assert_true(mkdir('doc', 'pR'))
call writefile(['some text', 'vim:ft=help:'], 'doc/help.txt', 'D')
split doc/help.txt
call assert_equal('help', &filetype)
bwipe!
call s:Check_help_with_iskeyword('doc/help.txt')
call writefile(['some text', 'Copyright: |manual-copyright| vim:ft=help:'],
\ 'doc/help1.txt', 'D')
split doc/help1.txt
call assert_equal('help', &filetype)
bwipe!
call s:Check_help_with_iskeyword('doc/help1.txt')
call writefile(['some text', 'vim:noet:ft=help:'], 'doc/help2.txt', 'D')
call s:Check_help_with_iskeyword('doc/help2.txt')
call writefile(['some text', 'vim: noet ft=help'], 'doc/help3.txt', 'D')
call s:Check_help_with_iskeyword('doc/help3.txt')
call writefile(['some text', 'vim: ft=help noet'], 'doc/help4.txt', 'D')
call s:Check_help_with_iskeyword('doc/help4.txt')
call writefile(['some text'], 'doc/nothelp.txt', 'D')
split doc/nothelp.txt