neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 53b41ec7c2c0ebc572b3a3795fda2167270fa480
parent 0741d2520dd7ac9e197dc9b177e8740190b2200b
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Fri,  2 May 2025 22:17:01 +0800

Merge pull request #33776 from zeertzjq/vim-9.1.1359

vim-patch:9.1.{1359,1360}
Diffstat:
Mruntime/lua/vim/filetype.lua | 3+++
Mruntime/syntax/cfg.vim | 2+-
Mruntime/syntax/confini.vim | 6++++++
Mtest/old/testdir/test_filetype.vim | 19++++++++++++++++++-
4 files changed, 28 insertions(+), 2 deletions(-)

diff --git 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', @@ -2280,6 +2281,8 @@ local pattern = { ['asterisk/.*%.conf'] = starsetf('asterisk'), ['asterisk.*/.*voicemail%.conf'] = starsetf('asteriskvm'), ['^dictd.*%.conf$'] = 'dictdconf', + ['/%.?gnuradio/.*%.conf$'] = 'confini', + ['/gnuradio/conf%.d/.*%.conf$'] = 'confini', ['/lxqt/.*%.conf$'] = 'dosini', ['/screengrab/.*%.conf$'] = 'dosini', ['/%.config/fd/ignore$'] = 'gitignore', diff --git a/runtime/syntax/cfg.vim b/runtime/syntax/cfg.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Good old CFG files " Maintainer: Igor N. Prischepoff (igor@tyumbit.ru, pri_igor@mail.ru) -" Last change: 2012 Aug 11 +" Last Change: 2012 Aug 11 " 2024 Nov 14 by Vim project: // only denotes a comment when starting a line (#16051) " quit when a syntax file was already loaded diff --git a/runtime/syntax/confini.vim b/runtime/syntax/confini.vim @@ -1,5 +1,7 @@ " Vim syntax file " Language: confini +" Last Change: +" 2025 May 02 by Vim project commented line starts with # only " Quit if a syntax file was already loaded if exists("b:current_syntax") @@ -9,4 +11,8 @@ endif " Use the cfg syntax for now, it's similar. runtime! syntax/cfg.vim +" Only accept '#' as the start of a comment. +syn clear CfgComment +syn match CfgComment "#.*" contains=@Spell + let b:current_syntax = 'confini' diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim @@ -183,7 +183,8 @@ func s:GetFilenameChecks() abort \ 'conaryrecipe': ['file.recipe'], \ 'conf': ['auto.master', 'file.conf', 'texdoc.cnf', '.x11vncrc', '.chktexrc', '.ripgreprc', 'ripgreprc', 'file.ctags'], \ 'config': ['configure.in', 'configure.ac', '/etc/hostname.file', 'any/etc/hostname.file'], - \ 'confini': ['pacman.conf', 'paru.conf', 'mpv.conf', 'any/.aws/config', 'any/.aws/credentials', 'file.nmconnection'], + \ 'confini': ['pacman.conf', 'paru.conf', 'mpv.conf', 'any/.aws/config', 'any/.aws/credentials', 'file.nmconnection', + \ 'any/.gnuradio/grc.conf', 'any/gnuradio/config.conf', 'any/gnuradio/conf.d/modtool.conf'], \ 'context': ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 'file.mkvi', 'file.mkxl', 'file.mklx'], \ 'cook': ['file.cook'], \ 'corn': ['file.corn'], @@ -1596,6 +1597,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'))