diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index c9fb539e3b..276691b080 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1390,6 +1390,7 @@ local extension = { yaml = 'yaml', eyaml = 'yaml', mplstyle = 'yaml', + grc = detect_line1('<%?xml', 'xml', 'yaml'), yang = 'yang', yuck = 'yuck', z8a = 'z8a', diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 3481e980eb..5641497738 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -1597,6 +1597,22 @@ func Test_git_file() filetype off endfunc +func Test_grc_file() + filetype on + + call writefile(['', '', ''], 'Xfile.grc') + split Xfile.grc + call assert_equal('xml', &filetype) + bwipe! + + call writefile(['metadata:', ' file_format: 1'], 'Xfile.grc') + split Xfile.grc + call assert_equal('yaml', &filetype) + bwipe! + + filetype off +endfunc + func Test_haredoc_file() filetype on call assert_true(mkdir('foo/bar', 'pR'))