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: #15689
Signed-off-by: Gregory Anders <greg@gpanders.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 0f71bd7..8f61189 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -2231,6 +2231,9 @@
au BufNewFile,BufRead .zshrc,.zshenv,.zlogin,.zlogout,.zcompdump,.zsh_history setf zsh
au BufNewFile,BufRead *.zsh,*.zsh-theme,*.zunit setf zsh
+" Salt state files
+au BufNewFile,BufRead *.sls setf salt
+
" Scheme ("racket" patterns are now separate, see above)
au BufNewFile,BufRead *.scm,*.ss,*.sld setf scheme
diff --git a/runtime/syntax/salt.vim b/runtime/syntax/salt.vim
new file mode 100644
index 0000000..fdbce2f
--- /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'