pearofducks / ansible-vim

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

Syntax highlighting of comments #108

Closed sohooo closed 4 years ago

sohooo commented 4 years ago

Hi,

when opening the following yaml file, the ansible syntax works but comments are not highlighted:

head pi.yaml
---
# vim: ft=ansible

# Pi Setup
#
#     run this with:
#     > ansible-playbook pi.yaml

- hosts: pi
...

I had to include the following line at the end of ansible-vim/syntax to detect comments:

diff --git a/syntax/ansible.vim b/syntax/ansible.vim
index 6e91e28..b710701 100644
--- a/syntax/ansible.vim
+++ b/syntax/ansible.vim
@@ -108,4 +108,7 @@ else
   highlight default link ansible_with_keywords Statement
 endif

+# highlight comments
+syn match   yamlComment             "#.*"
+
 let b:current_syntax = "ansible"
pearofducks commented 4 years ago

Can you clarify? Do you mean comments aren't formatted as comments? (If so, I'm unable to reproduce this)

Or you want highlighting inside of comments?

sohooo commented 4 years ago

Sry @pearofducks , must have been an error on my side (which I expected anyway for this basic feature ;), maybe during :Plug update. Everything is fine now after reinstall.