Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to define every highlight variable by syntax group name #67

Open
maethor opened this issue Aug 7, 2018 · 3 comments
Open

Allow to define every highlight variable by syntax group name #67

maethor opened this issue Aug 7, 2018 · 3 comments

Comments

@maethor
Copy link

maethor commented Aug 7, 2018

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.

@pearofducks
Copy link
Owner

pearofducks commented Aug 7, 2018

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.

@maethor
Copy link
Author

maethor commented Aug 7, 2018

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".

@savchenko
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants