diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 10ecefc7d2..2ace52f4fc 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -2048,6 +2048,7 @@ local patterns_text = { ['^From [a-zA-Z][a-zA-Z_0-9%.=%-]*(@[^ ]*)? .* 20%d%d$'] = 'mail', ['^From %- .* 19%d%d$'] = 'mail', ['^From %- .* 20%d%d$'] = 'mail', + ['^[Rr][Ee][Tt][Uu][Rr][Nn]%-[Pp][Aa][Tt][Hh]:%s<.*@.*>$'] = 'mail', -- Mason ['^<[%%&].*>'] = 'mason', -- Vim scripts (must have '" vim' as the first line to trigger this) @@ -2164,6 +2165,10 @@ local patterns_text = { -- #ncomment is allowed but most likely a false positive so require a space before any trailing comment text ['^#n%s'] = 'sed', ['^#n$'] = 'sed', + ['^#%s+Reconstructed via infocmp from file:'] = 'terminfo', + ['^File: .*%.info, Node: .*, Next: .*, Up: '] = 'info', + ['^File: .*%.info, Node: .*, Prev: .*, Up: '] = 'info', + ['This is the top of the INFO tree.'] = 'info', } --- File does not start with "#!". diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 06506fca8b..d38c4a45d9 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -2990,6 +2990,39 @@ func Test_org_file() filetype off endfunc +func Test_info_file() + filetype on + + call writefile(['File: coreutils.info, Node: Top, Next: Introduction, Up: (dir)', 'D'], 'Xfile', 'D') + split Xfile + call assert_equal('info', &filetype) + bwipe! + + filetype off +endfunc + +func Test_mail_file() + filetype on + + call writefile(['Return-path: ', 'D'], 'Xfile', 'D') + split Xfile + call assert_equal('mail', &filetype) + bwipe! + + filetype off +endfunc + +func Test_terminfo_file() + filetype on + + call writefile(['# Reconstructed via infocmp from file: /etc/terminfo/x/xterm', 'D'], 'Xfile', 'D') + split Xfile + call assert_equal('terminfo', &filetype) + bwipe! + + filetype off +endfunc + " Filetypes detected from names of existing files func Test_pacmanlog() filetype on