aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-03-11 06:48:17 +0800
committerGitHub <noreply@github.com>2025-03-11 06:48:17 +0800
commit0ef1147313caa47c87c7baa79043ddcff55ef5e1 (patch)
treea6dba157e101e0e63327d20ae431e43c6a88f885 /runtime/lua/vim
parentf2c0755828d529af101b5d0e4a1fd204fd0a7039 (diff)
parent4533c40786a68d57b878babd46ea70e761392cf0 (diff)
downloadrneovim-0ef1147313caa47c87c7baa79043ddcff55ef5e1.tar.gz
rneovim-0ef1147313caa47c87c7baa79043ddcff55ef5e1.tar.bz2
rneovim-0ef1147313caa47c87c7baa79043ddcff55ef5e1.zip
Merge pull request #32828 from zeertzjq/vim-9.1.1186
vim-patch:9.1.{1186,1191,1194}: filetype: help files in git repos are not detected
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/filetype.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 2c058bc6bf..b2ddd461cc 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -2415,7 +2415,13 @@ local pattern = {
['/boot/grub/menu%.lst$'] = 'grub',
-- gtkrc* and .gtkrc*
['^%.?gtkrc'] = starsetf('gtkrc'),
- ['^${VIMRUNTIME}/doc/.*%.txt$'] = 'help',
+ ['/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
+ return 'help'
+ end
+ end,
['^hg%-editor%-.*%.txt$'] = 'hgcommit',
['%.html%.m4$'] = 'htmlm4',
['^JAM.*%.'] = starsetf('jam'),