Reputation: 3507
I use pandoc a lot which means that I write with a mix of markdown and latex a lot. The problem is that I can't make Vim highlight Latex as it should, even though pandoc understands it.
For example, the following snipet
# Header 1
Variable $x_0$ is defined as
\begin{align}
x_0=y_0^2
\end{align}
If I name it test.md
Vim only sees markdown and fails to highlight $x_0$
and the align
environment. I can make the situation a little bit better if I follow this answer then I can at least make the $ $
highlighted.
As a quick workaround I found that by naming the file with a .Rmd
extension I get the $ $
to work, although that isn't strictly correct I guess.
But so far I have not been able to get both Markdown Syntax and Latex syntax simultaneously. Is there a way that can be done?
PS: I'm really trying to avoid installing obscure Vim plugins that need Vundle etc in the name of portability!
Upvotes: 3
Views: 790
Reputation: 3507
The work around I found (almost by accident) was to copy this file, which is a syntax file for Pandoc, into ftplugin
and add these lines to vimrc
augroup pandoc_syntax
au! BufNewFile,BufFilePre,BufRead *.md set filetype=markdown.pandoc
augroup END
This is actually part of a plugin. But I found that this way is much simpler than having the whole plugin installed and much more portable.
Upvotes: 4