pearofducks / ansible-vim

A vim plugin for syntax highlighting Ansible's common filetypes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to define every highlight variable by syntax group name

maethor opened this issue · comments

Hi,

It would be nice and consistent to be able to configure g:ansible_extra_keywords_highlight like g:ansible_normal_keywords_highlight and g:ansible_with_keywords_highlight. I'd like them all with the same style.

An easy way would be to define a sane default style for g:ansible_extra_keywords_highlight (Identifier I suppose), and allow the user to use a style instead of just "1" to enable a second pre-defined style.

I could be extended to g:ansible_name_highlight and g:ansible_attribute_highlight. For instance I would really like to set ansible_name_highlight on Tag instead of Underlined.

I agree with you and do have plans to unify them under the same style at some point. Unfortunately since this is a major breaking-change (or at the very least a change in how this is all handled) I'd like to take it in phases somehow.

The reason this hasn't been done yet is at v2 I switched to the compound syntax, and wanted to avoid too many changes at once.

Ok. I understand.

I admit I don't know anything in vim script. Would it be difficult to make it reverse compatible with the current syntax? I mean, you can try to catch "if it's 'd' or 'b' then use predefined style for dim or brighten, else it should be directly the style name".

For instance I would really like to set ansible_name_highlight on Tag instead of Underlined.

You can do that and more via your theme file and some minor tweaks to the plugin. For example:

" Ansible-vim
"             group                      FG        BG   Attr     SP
call <sid>hi("ansible_loop_keywords"   , s:gui08 , "" , ""     , "")
call <sid>hi("ansible_name"            , s:gui03 , "" , ""     , "")
call <sid>hi("ansible_normal_keywords" , s:gui08 , "" , ""     , "")
call <sid>hi("ansible_task_name"       , s:gui08 , "" , "bold" , "")
call <sid>hi("jinjaFilter"             , s:blue  , "" , ""     , "")
call <sid>hi("jinjaNested"             , s:gui09 , "" , ""     , "")
" ...

and

syn match ansible_name "\v^\s*-\sname\:\s\w.*" contains=ansible_task_name keepend
highlight default link ansible_name ansible_name
syn region ansible_task_name start="[^- name:]" end="$" contained
highlight default link ansible_task_name ansible_task_name