pearofducks / ansible-vim

A vim plugin for syntax highlighting Ansible's common filetypes
MIT License
796 stars 98 forks source link

Use default when linking new syntax groups #81

Closed rhodesn closed 5 years ago

rhodesn commented 5 years ago

I was hoping to override some of the highlight links that you have in syntax/ansible_hosts.vim. It would be a simple change to.

diff --git a/syntax/ansible_hosts.vim b/syntax/ansible_hosts.vim
index 5ecc4da..0fca099 100644
--- a/syntax/ansible_hosts.vim
+++ b/syntax/ansible_hosts.vim
@@ -14,17 +14,18 @@ syn region hostsHeader        start="\v^\s*\[" end="\v\]"
 syn keyword hostsHeaderSpecials children vars containedin=hostsHeader contained
 syn match  hostsComment       "\v^[#;].*$"

-highlight link hostsFirstWord        Label
-highlight link hostsHeader           Define
-highlight link hostsComment          Comment
-highlight link hostsHeaderSpecials   Identifier
-highlight link hostsAttributes       Structure
+highlight default link hostsFirstWord        Label
+highlight default link hostsHeader           Define
+highlight default link hostsComment          Comment
+highlight default link hostsHeaderSpecials   Identifier

 if exists("g:ansible_attribute_highlight")
   if g:ansible_attribute_highlight =~ 'n'
-    highlight link hostsAttributes NONE
+    highlight default link hostsAttributes NONE
   elseif g:ansible_attribute_highlight =~ 'd'
-    highlight link hostsAttributes Comment
+    highlight default link hostsAttributes Comment
+  else
+    highlight default link hostsAttributes Structure
   endif
 endif

Will submit PR for the ansible_hosts.vim file, let me know if you would like the same change made to the ansible.vim syntax file.