pearofducks / ansible-vim

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

Syntax highlighting: almost nothing is highlighted #133

Closed Nudin closed 2 years ago

Nudin commented 2 years ago

Recently the plugin's syntax highlithing stoped working properly. Almost nothing is highlighed: grafik

I stripped down the vimrc to the minimum – and the error persists.

syntax on

call plug#begin('~/.vim/plugged')
Plug 'pearofducks/ansible-vim'
call plug#end()

" colorscheme badwolf  <– used in above screenshot but also doesn't matter

Interesting (confusing) note: When I install the plugin like above, the error is and stays this way. If I however install the plugin indirectly through sheerun/vim-polyglot I get the same behavior after opening a file – but if I then do a let filetype=yaml.ansible or syntax on – even though both don't change the values – syntax highlighting suddenly works normally.

I use NVIM v0.7.2 – VIM 9.0 shows the same issue

pearofducks commented 2 years ago

I'm unable to see any problems in Neovim 0.7.2. You might need to adjust your color scheme as this plugin isn't setting a specific color, but is rather setting a hightlight group like Identifier.

I used this slightly modified minimal file, and used the f10 binding you can see what specific highlights are being set to.

syntax on

call plug#begin('~/.local/share/nvim/site/plugged')
Plug 'pearofducks/ansible-vim'
Plug 'altercation/vim-colors-solarized'
call plug#end()

set background=dark
colorscheme solarized

let g:ansible_attribute_highlight = 'ob'
let g:ansible_name_highlight = 'd'

map <F10> :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<'
\ . synIDattr(synID(line("."),col("."),0),"name") . "> lo<"
\ . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
Nudin commented 2 years ago

No, it's not an issue with the color scheme, it's the same with your minimal rc. With the given keybinding I also can verify that there are no hightlight groups for, for example,name in a playbook.

pearofducks commented 2 years ago

OK, I'm not able to reproduce that.

Nudin commented 2 years ago

Ok, this is weird: After a fresh reinstallation of neovim it works with the minimal vimrc!? (No idea how on earth it broke) With my real vimrc it still had the issue, and it stoped when disabling the plugin vim-indent-guides.

So probably not an issue in this plugin. Closing for now. Sorry for the inconveniences.