patch 9.1.1360: filetype: GNU Radio companion files are not recognized Commit: https://github.com/vim/vim/commit/af4a5d6e2ae57a44edab48c8b012d2afa743998f Author: zeertzjq <zeert...@outlook.com> Date: Fri May 2 15:35:58 2025 +0200
patch 9.1.1360: filetype: GNU Radio companion files are not recognized Problem: filetype: GNU Radio companion files are not recognized Solution: detect *.grc files as xml or yaml filetype depending on the first line (zeertzjq). Ref: - https://wiki.gnuradio.org/index.php/XML_GRC - https://wiki.gnuradio.org/index.php/YAML_GRC closes: #17241 Signed-off-by: zeertzjq <zeert...@outlook.com> Signed-off-by: Christian Brabandt <c...@256bit.org> diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 209f0dc2e..a6f13c8b8 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1023,6 +1023,14 @@ au BufNewFile,BufRead *.gjs setf javascript.glimmer " Gnuplot scripts au BufNewFile,BufRead *.gpi,*.gnuplot,.gnuplot_history setf gnuplot +" GNU Radio Companion files +au BufNewFile,BufRead *.grc + \ if getline(1) =~# '<?xml' | + \ setf xml | + \ else | + \ setf yaml | + \ endif + " Go (Google) au BufNewFile,BufRead *.go setf go au BufNewFile,BufRead Gopkg.lock setf toml diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index bfafdbb36..7cac3d0aa 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -1631,6 +1631,22 @@ func Test_git_file() filetype off endfunc +func Test_grc_file() + filetype on + + call writefile(['<?xml version="1.0"?>', '<block>', '</block>'], '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')) diff --git a/src/version.c b/src/version.c index d64a1e6c5..c0c98b40b 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1360, /**/ 1359, /**/ -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/vim_dev/E1uAqhN-003X9k-9f%40256bit.org.