From 9a3f74c4c7fa567bb492cc3604b6baca05c22f1a Mon Sep 17 00:00:00 2001 From: Gregory Anders Date: Tue, 17 Sep 2024 14:17:51 -0500 Subject: [PATCH] vim-patch:9.1.0735: filetype: salt files are not recognized Problem: filetype: salt files are not recognized Solution: Detect '*.sls' files as filetype salt, include a syntax script (Gregory Anders) closes: vim/vim#15689 https://github.com/vim/vim/commit/89b9bb4ac8ceb701ebecb8c02aca3d047dff9991 Co-authored-by: Gregory Anders --- runtime/lua/vim/filetype.lua | 1 + runtime/syntax/salt.vim | 16 ++++++++++++++++ test/old/testdir/test_filetype.vim | 1 + 3 files changed, 18 insertions(+) create mode 100644 runtime/syntax/salt.vim diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index d549428158..bd55c97f15 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -1024,6 +1024,7 @@ local extension = { rake = 'ruby', rs = 'rust', sage = 'sage', + sls = 'salt', sas = 'sas', sass = 'sass', sa = 'sather', diff --git a/runtime/syntax/salt.vim b/runtime/syntax/salt.vim new file mode 100644 index 0000000000..fdbce2f677 --- /dev/null +++ b/runtime/syntax/salt.vim @@ -0,0 +1,16 @@ +" Vim syntax file +" Maintainer: Gregory Anders +" Last Changed: 2024-09-16 + +if exists('b:current_syntax') + finish +endif + +" Salt state files are just YAML with embedded Jinja +runtime! syntax/yaml.vim +unlet! b:current_syntax + +runtime! syntax/jinja.vim +unlet! b:current_syntax + +let b:current_syntax = 'salt' diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 31a51f1254..51b6f884f4 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -633,6 +633,7 @@ func s:GetFilenameChecks() abort \ 'rtf': ['file.rtf'], \ 'ruby': ['.irbrc', 'irbrc', '.irb_history', 'irb_history', 'file.rb', 'file.rbw', 'file.gemspec', 'file.ru', 'Gemfile', 'file.builder', 'file.rxml', 'file.rjs', 'file.rant', 'file.rake', 'rakefile', 'Rakefile', 'rantfile', 'Rantfile', 'rakefile-file', 'Rakefile-file', 'Puppetfile', 'Vagrantfile'], \ 'rust': ['file.rs'], + \ 'salt': ['file.sls'], \ 'samba': ['smb.conf'], \ 'sas': ['file.sas'], \ 'sass': ['file.sass'],