2

For most files, Vim (terminal) is syntax highlighting properly without any issues. However, I am unable to get it to work for CMakeLists.txt:

enter image description here

Neovim has no trouble with syntax highlighting, neither does gvim. I also tried this plugin with no effect: https://github.com/pboettch/vim-cmake-syntax

I have the following in my .vimrc

filetype plugin indent on
syntax on
set t_Co=256
au BufNewFile,BufRead *.cmake,CMakeLists.txt set filetype=cmake
# tried this variation too
# autocmd BufEnter *.cmake,CMakeLists.txt,*.cmake.in :setlocal filetype=cmake

2 Answers 2

1

The issue it turns out is a conflict with the Rainbow Parenthesis plugin: https://github.com/kien/rainbow_parentheses.vim, which is too bad as it's a nice plugin but the syntax highlighting functionality is more important.

For future reference, the following variant of the Rainbow Parenthesis plugin is also problematic: https://github.com/luochen1990/rainbow

1
0

https://github.com/luochen1990/rainbow/issues/77

If using https://github.com/luochen1990/rainbow, we can turn it off for cmake language.

A workaround (as @luochen1990 already noted): Disable the rainbow plugin for CMake files.

let g:rainbow_conf = {
\   'separately': {
\       'cmake': 0,
\   }
\}
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.