Skip to content

Commit

Permalink
fix(syntax): conflict ^^X special chars and ^^A comment
Browse files Browse the repository at this point in the history
refer: #1988
  • Loading branch information
lervag committed Mar 11, 2021
1 parent 4a21851 commit dd03360
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
30 changes: 15 additions & 15 deletions autoload/vimtex/syntax/core.vim
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ function! vimtex#syntax#core#init() abort " {{{1

" }}}2

" {{{2 TeX symbols and special characters

syntax match texLigature "--"
syntax match texLigature "---"
syntax match texLigature "\v%(``|''|,,)"
syntax match texTabularChar "&"
syntax match texTabularChar "\\\\"

" E.g.: \$ \& \% \# \{ \} \_ \S \P
syntax match texSpecialChar "\\[$&%#{}_]"
syntax match texSpecialChar "\\[SP@]\ze[^a-zA-Z@]"
syntax match texSpecialChar "\^\^\%(\S\|[0-9a-f]\{2}\)"
syntax match texSpecialChar "\\[,;:!]"

" }}}2
" {{{2 Comments

" * In documented TeX Format, actual comments are defined by leading "^^A".
Expand Down Expand Up @@ -81,21 +96,6 @@ function! vimtex#syntax#core#init() abort " {{{1
\ containedin=texComment contained
syntax case match

" }}}2
" {{{2 TeX symbols and special characters

syntax match texLigature "--"
syntax match texLigature "---"
syntax match texLigature "\v%(``|''|,,)"
syntax match texTabularChar "&"
syntax match texTabularChar "\\\\"

" E.g.: \$ \& \% \# \{ \} \_ \S \P
syntax match texSpecialChar "\\[$&%#{}_]"
syntax match texSpecialChar "\\[SP@]\ze[^a-zA-Z@]"
syntax match texSpecialChar "\^\^\%(\S\|[0-9a-f]\{2}\)"
syntax match texSpecialChar "\\[,;:!]"

" }}}2
" {{{2 Commands: general

Expand Down
3 changes: 3 additions & 0 deletions test/test-syntax/test-core.dtx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

^^A asdasd

0 comments on commit dd03360

Please sign in to comment.