Add option to disable (La)TeX syntax highlighting

This commit is contained in:
Alex Vear
2020-09-08 19:47:57 +01:00
parent f50c700b87
commit 0af5ca0324
3 changed files with 29 additions and 10 deletions

1
TODO
View File

@@ -1,5 +1,4 @@
* Future * Future
- Option to disable TeX highlighting.
- Syntax highlight checkboxes and checkbox cookies - Syntax highlight checkboxes and checkbox cookies
- Separate syntax group for heading delimiters - Separate syntax group for heading delimiters
- Syntax highlight and indent "properties" - Syntax highlight and indent "properties"

View File

@@ -122,6 +122,23 @@ To disable italics only in a single buffer, use this instead:
> >
let b:org_use_italics = 0 let b:org_use_italics = 0
< <
------------------------------------------------------------------------------
*'b:org_highlight_tex'* *'g:org_highlight_tex'*
Value: numeric~
Default: 1~
Enable/disable syntax highlighting of inline (La)TeX blocks[4]. This option
exists as some Org mode users don't use TeX and may find the highlighting
annoying.
To disable for all Org mode files place the following line in your vimrc:
>
let g:org_highlight_tex = 0
<
To disable only in a single buffer, use this instead:
>
let b:org_highlight_tex = 0
<
============================================================================== ==============================================================================
4. CHANGE LOG *org-changelog* 4. CHANGE LOG *org-changelog*
@@ -188,6 +205,7 @@ works are:
[1]: <https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html> [1]: <https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html>
[2]: <https://orgmode.org/> [2]: <https://orgmode.org/>
[3]: <http://vimdoc.sourceforge.net/htmldoc/uganda.html#license> [3]: <http://vimdoc.sourceforge.net/htmldoc/uganda.html#license>
[4]: <https://orgmode.org/manual/LaTeX-fragments.html>
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
vim:et:ts=4:sts=4:sw=4:tw=78:ft=help:norl: vim:et:ts=4:sts=4:sw=4:tw=78:ft=help:norl:

View File

@@ -122,6 +122,7 @@ highlight def link orgHyperRight Comment
" TeX " TeX
" Ref: https://orgmode.org/manual/LaTeX-fragments.html " Ref: https://orgmode.org/manual/LaTeX-fragments.html
if org#option('org_highlight_tex', 1)
syntax include @LATEX syntax/tex.vim syntax include @LATEX syntax/tex.vim
syntax region orgMath start="\\begin\[.*\]{.*}" end="\\end{.*}" keepend contains=@LATEX syntax region orgMath start="\\begin\[.*\]{.*}" end="\\end{.*}" keepend contains=@LATEX
syntax region orgMath start="\\begin{.*}" end="\\end{.*}" keepend contains=@LATEX syntax region orgMath start="\\begin{.*}" end="\\end{.*}" keepend contains=@LATEX
@@ -131,6 +132,7 @@ syntax region orgMath start="\S\@<=\$\|\$\S\@=" end="\S\@<=\$\|\$\S\@=" keepend
syntax region orgMath start=/\$\$/ end=/\$\$/ keepend contains=@LATEX syntax region orgMath start=/\$\$/ end=/\$\$/ keepend contains=@LATEX
syntax match orgMath /\\\$/ conceal cchar=$ syntax match orgMath /\\\$/ conceal cchar=$
highlight def link orgMath String highlight def link orgMath String
endif
let b:current_syntax = 'org' let b:current_syntax = 'org'