aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
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..4c6b3b108f 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:')
+ 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'),