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

Compatibility with luochen1990/rainbow #1672

Closed
gvdeynde opened this issue Apr 21, 2020 · 8 comments
Closed

Compatibility with luochen1990/rainbow #1672

gvdeynde opened this issue Apr 21, 2020 · 8 comments
Labels

Comments

@gvdeynde
Copy link

It seems the syntax file in vimtex perturbs the rainbow parenthesis plugin https://github.com/luochen1990/rainbow.

Opening a tex file, I don't see any rainbow parenthesis. If I then manually set the filetype to plaintex, the rainbow parenthesis plugin works and the colored parentheses appear...

I've posted this also at the rainbow plugin (luochen1990/rainbow#142), but no response there...

Any tips welcome....

Thanks.

@gvdeynde gvdeynde added the bug label Apr 21, 2020
@lervag
Copy link
Owner

lervag commented Apr 21, 2020

Strange. It works for me. But in a minimal example, it does not work quite as expected. :RainbowToggle does enable the rainbows, though. Does that work for you as an alternative to changing filetype?

@lervag
Copy link
Owner

lervag commented Apr 21, 2020

Ok, sorry, I've created a minimal example that works just as expected, see here:

set nocompatible
let &runtimepath = '~/.vim/bundle/rainbow,' . &runtimepath
let &runtimepath = '~/.vim/bundle/vimtex,' . &runtimepath
let &runtimepath .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable

nnoremap q :qall!<cr>

let g:rainbow_active = 1

and

\documentclass{minimal}
\begin{document}

Hello World! (((()))) {{{{{}}}}}

\end{document}

With nvim -u test.vim test.tex things work as expected, as can be seen in the
following screenshot.

screen

@gvdeynde
Copy link
Author

gvdeynde commented Apr 22, 2020

Euhmmm. Can you try this, a bit less minimal, example?
And I would have expected the curly braces also to be 'rainbowed', no?

\documentclass{minimal}
\begin{document}

Hello World! (((()))) {{{{{}}}}}

\section*{Test}

Hello World! ((())) {{{}}}

\end{document}

I get this as a result:

image

@lervag
Copy link
Owner

lervag commented Apr 22, 2020

Ah, I see. This is reproducible, but it is not a vimtex issue. Instead, this is caused by the syntax plugin which comes with Vim/neovim. The problem is due to the tex syntax that specifically matches parantheses inside sections and curly braces in general.

Not sure if it is possible to do anything about it.

@gvdeynde
Copy link
Author

FYI: in my minimal example, if I set the filetype manually to plaintex, it works... for both () and {} in both lines 4 and 8...

@lervag
Copy link
Owner

lervag commented Apr 22, 2020

Yes, but plaintex is a different filetype which has a much simpler syntax specification. Feel free to use it if you find rainbow parantheses more important than advanced syntax highlighting.

For more info, see :edit $VIMRUNTIME/syntax/plaintex.vim and :edit $VIMRUNTIME/syntax/tex.vim.

@gvdeynde
Copy link
Author

gvdeynde commented Apr 22, 2020

Thanks for looking in to this so quickly anyway.

I'll go for the advanced syntax highlighting any time of day. The rainbow parentheses are sugar on the cake when I have a large formula with a lot of fractions combined with sub/superscripts... So when debugging the latter, I'll switch syntax manually....

Thanks again (and <applause> in general for vimtex </applause> )

@lervag
Copy link
Owner

lervag commented Apr 22, 2020

Thanks for the applause :)

Note, I think your issue should be followed up by luochen. I've added an update on that issue.

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

No branches or pull requests

2 participants