mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	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#17071e370141bf4(cherry picked from commit8af9f8ab5e)
This commit is contained in:
		 zeertzjq
					zeertzjq
				
			
				
					committed by
					
						![github-actions[bot]](/assets/img/avatar_default.png) github-actions[bot]
						github-actions[bot]
					
				
			
			
				
	
			
			
			![github-actions[bot]](/assets/img/avatar_default.png) github-actions[bot]
						github-actions[bot]
					
				
			
						parent
						
							6e51d39696
						
					
				
				
					commit
					a92155b86b
				
			| @@ -2427,8 +2427,26 @@ local pattern = { | |||||||
|     ['^%.?gtkrc'] = starsetf('gtkrc'), |     ['^%.?gtkrc'] = starsetf('gtkrc'), | ||||||
|     ['/doc/.*%.txt$'] = function(_, bufnr) |     ['/doc/.*%.txt$'] = function(_, bufnr) | ||||||
|       local line = M._getline(bufnr, -1) |       local line = M._getline(bufnr, -1) | ||||||
|       local ml = line:find('^vim:') or line:find('%svim:') |       if | ||||||
|       if ml and M._matchregex(line:sub(ml), [[\<\(ft\|filetype\)=help\>]]) then |         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' |         return 'help' | ||||||
|       end |       end | ||||||
|     end, |     end, | ||||||
|   | |||||||
| @@ -1628,20 +1628,36 @@ func Test_haredoc_file() | |||||||
| endfunc | endfunc | ||||||
|  |  | ||||||
| func Test_help_file() | 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 |   set nomodeline | ||||||
|   filetype on |   filetype on | ||||||
|   call assert_true(mkdir('doc', 'pR')) |   call assert_true(mkdir('doc', 'pR')) | ||||||
|  |  | ||||||
|   call writefile(['some text', 'vim:ft=help:'], 'doc/help.txt', 'D') |   call writefile(['some text', 'vim:ft=help:'], 'doc/help.txt', 'D') | ||||||
|   split doc/help.txt |   call s:Check_help_with_iskeyword('doc/help.txt') | ||||||
|   call assert_equal('help', &filetype) |  | ||||||
|   bwipe! |  | ||||||
|  |  | ||||||
|   call writefile(['some text', 'Copyright: |manual-copyright| vim:ft=help:'], |   call writefile(['some text', 'Copyright: |manual-copyright| vim:ft=help:'], | ||||||
|         \ 'doc/help1.txt', 'D') |         \ 'doc/help1.txt', 'D') | ||||||
|   split doc/help1.txt |   call s:Check_help_with_iskeyword('doc/help1.txt') | ||||||
|   call assert_equal('help', &filetype) |  | ||||||
|   bwipe! |   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') |   call writefile(['some text'], 'doc/nothelp.txt', 'D') | ||||||
|   split doc/nothelp.txt |   split doc/nothelp.txt | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user