0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

More accented characters in tex.vim syntax. (Charles Campbell)

This commit is contained in:
Bram Moolenaar 2010-07-28 17:25:21 +02:00
parent c6485bceb1
commit e0021c79a5

View File

@ -1,8 +1,8 @@
" Vim syntax file " Vim syntax file
" Language: TeX " Language: TeX
" Maintainer: Dr. Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM> " Maintainer: Dr. Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM>
" Last Change: Jul 26, 2010 " Last Change: Jul 28, 2010
" Version: 49 " Version: 51
" URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
" "
" Notes: {{{1 " Notes: {{{1
@ -126,8 +126,8 @@ if !exists("tex_no_math")
syn cluster texSubSubSectionGroup contains=texParaZone syn cluster texSubSubSectionGroup contains=texParaZone
syn cluster texParaGroup contains=texSubParaZone syn cluster texParaGroup contains=texSubParaZone
if has("conceal") && &enc == 'utf-8' if has("conceal") && &enc == 'utf-8'
syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript syn cluster texMathZoneGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript syn cluster texMathMatchGroup add=texGreek,texSuperscript,texSubscript,texMathSymbol
endif endif
endif endif
@ -341,10 +341,17 @@ if !exists("tex_no_math")
call TexNewMathZone("L","xxalignat",0) call TexNewMathZone("L","xxalignat",0)
" Inline Math Zones: {{{2 " Inline Math Zones: {{{2
if has("conceal") && &enc == 'utf-8'
syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend concealends contains=@texMathZoneGroup
syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" concealends contains=@texMathZoneGroup
syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" concealends keepend contains=@texMathZoneGroup
else
syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup syn region texMathZoneV matchgroup=Delimiter start="\\(" matchgroup=Delimiter end="\\)\|%stopzone\>" keepend contains=@texMathZoneGroup
syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup syn region texMathZoneW matchgroup=Delimiter start="\\\[" matchgroup=Delimiter end="\\]\|%stopzone\>" keepend contains=@texMathZoneGroup
syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup syn region texMathZoneX matchgroup=Delimiter start="\$" skip="\\\\\|\\\$" matchgroup=Delimiter end="\$" end="%stopzone\>" contains=@texMathZoneGroup
syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup syn region texMathZoneY matchgroup=Delimiter start="\$\$" matchgroup=Delimiter end="\$\$" end="%stopzone\>" keepend contains=@texMathZoneGroup
endif
syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup syn region texMathZoneZ matchgroup=texStatement start="\\ensuremath\s*{" matchgroup=texStatement end="}" end="%stopzone\>" contains=@texMathZoneGroup
syn match texMathOper "[_^=]" contained syn match texMathOper "[_^=]" contained
@ -530,10 +537,11 @@ if has("conceal") && &enc == 'utf-8'
call s:Greek('texGreek','\\Phi\>' ,'Φ') call s:Greek('texGreek','\\Phi\>' ,'Φ')
call s:Greek('texGreek','\\Psi\>' ,'Ψ') call s:Greek('texGreek','\\Psi\>' ,'Ψ')
call s:Greek('texGreek','\\Omega\>' ,'Ω') call s:Greek('texGreek','\\Omega\>' ,'Ω')
delfun s:Greek
" Superscripts/Subscripts {{{2 " Superscripts/Subscripts {{{2
syn region texSuperscript start='\^{' end='}' contained contains=texSuperscripts syn region texSuperscript matchgroup=Delimiter start='\^{' end='}' contained concealends contains=texSuperscripts
syn region texSubscript start='_{' end='}' contained contains=texSubscripts syn region texSubscript matchgroup=Delimiter start='_{' end='}' contained concealends contains=texSubscripts
fun! s:SuperSub(group,leader,pat,cchar) fun! s:SuperSub(group,leader,pat,cchar)
exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar exe 'syn match '.a:group." '".a:leader.a:pat."' contained conceal cchar=".a:cchar
exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s' exe 'syn match '.a:group."s '".a:pat."' contained conceal cchar=".a:cchar.' nextgroup='.a:group.'s'
@ -629,75 +637,63 @@ if has("conceal") && &enc == 'utf-8'
call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ') call s:SuperSub('texSubscript','_','\\phi\>' ,'ᵩ')
call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ') call s:SuperSub('texSubscript','_','\\gamma\>','ᵧ')
call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ') call s:SuperSub('texSubscript','_','\\chi\>' ,'ᵪ')
delfun s:SuperSub
" Accented characters: {{{2 " Accented characters: {{{2
if b:tex_stylish if b:tex_stylish
syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1 syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1
syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1 syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1
else else
syn match texAccent '\\`{a}' conceal cchar=à fun! s:Accents(chr,...)
syn match texAccent '\\\'{a}' conceal cchar=á let i= 1
syn match texAccent '\\^{a}' conceal cchar=â for accent in ["`","\\'","^",'"','\~',"r","v"]
syn match texAccent '\\"{a}' conceal cchar=ä if i > a:0
syn match texAccent '\\\~{a}' conceal cchar=ã break
syn match texAccent '\\r{a}' conceal cchar=å endif
syn match texAccent '\\`{A}' conceal cchar=À if strlen(a:{i}) == 0
syn match texAccent '\\\'{A}' conceal cchar=Á let i= i + 1
syn match texAccent '\\^{A}' conceal cchar=Â continue
syn match texAccent '\\"{A}' conceal cchar=Ä endif
syn match texAccent '\\\~{A}' conceal cchar=Ã exe "syn match texAccent '\\\\".accent."{".a:chr."}' conceal cchar=".a:{i}
syn match texAccent '\\r{A}' conceal cchar=Å let i= i + 1
endfor
endfun
call s:Accents('a','à','á','â','ä','ã','å','ă')
call s:Accents('A','À','Á','Â','Ä','Ã','Å','Ă')
call s:Accents('C',"" ,'Ć','Ĉ',"" ,"" ,"" ,'Ć')
call s:Accents('e','è','é','ê','ë','ẽ',"" ,'ĕ')
call s:Accents('E','È','É','Ê','Ë','Ẽ',"" ,'Ė')
call s:Accents('i','ì','í','î','ï','ĩ',"" ,"ĭ")
call s:Accents('I','Ì','Í','Î','Ï','Ĩ',"" ,'Ĭ')
call s:Accents('o','ò','ó','ô','ö','õ',"" ,'ŏ')
call s:Accents('O','Ò','Ó','Ô','Ö','Õ',"" ,'Ŏ')
call s:Accents('r',"" ,'ŕ',"" ,"" ,"" ,"" ,'ř')
call s:Accents('R',"" ,'Ŕ',"" ,"" ,"" ,"" ,'Ř')
call s:Accents('s',"" ,'ś','ŝ',"" ,"" ,"" ,'š')
call s:Accents('S',"" ,'Ś','Ŝ',"" ,"" ,"" ,'Š')
call s:Accents('u','ù','ú','û','ü','ũ',"" ,'ŭ')
call s:Accents('U','Ù','Ú','Û','Ü','Ũ',"" ,'Ŭ')
call s:Accents('y','ỳ','ý','ŷ','ÿ','ỹ',"" ,"" )
call s:Accents('Y','Ỳ','Ý','Ŷ','Ÿ','Ỹ',"" ,"" )
delfun s:Accents
syn match texAccent '\\aa\>' conceal cchar=å
syn match texAccent '\\AA\>' conceal cchar=Å
syn match texAccent '\\k{a}' conceal cchar=ą
syn match texAccent '\\k{A}' conceal cchar=Ą
syn match texAccent '\\c{C}' conceal cchar=Ç
syn match texAccent '\\c{c}' conceal cchar=ç syn match texAccent '\\c{c}' conceal cchar=ç
syn match texAccent '\\`{e}' conceal cchar=è syn match texAccent '\\\~{n}' conceal cchar=ñ
syn match texAccent '\\\'{e}' conceal cchar=é syn match texAccent '\\\~{N}' conceal cchar=Ñ
syn match texAccent '\\^{e}' conceal cchar=ê syn match texAccent '\\o\>' conceal cchar=ø
syn match texAccent '\\"{e}' conceal cchar=ë syn match texAccent '\\O\>' conceal cchar=Ø
syn match texAccent '\\\~{e}' conceal cchar= syn match texAccent '\\H{o}' conceal cchar=ő
syn match texAccent '\\`{E}' conceal cchar=È syn match texAccent '\\H{O}' conceal cchar=Ő
syn match texAccent '\\\'{E}' conceal cchar=É syn match texAccent '\\c{r}' conceal cchar=ŗ
syn match texAccent '\\^{E}' conceal cchar=Ê syn match texLigature '\\AE\>' conceal cchar=Æ
syn match texAccent '\\"{E}' conceal cchar=Ë syn match texLigature '\\ae\>' conceal cchar=æ
syn match texAccent '\\\~{E}' conceal cchar= syn match texLigature '\\oe\>' conceal cchar=œ
syn match texAccent '\\`{i}' conceal cchar=ì syn match texLigature '\\OE\>' conceal cchar=Œ
syn match texAccent '\\\'{i}' conceal cchar=í syn match texLigature '\\ss\>' conceal cchar=ß
syn match texAccent '\\^{i}' conceal cchar=î
syn match texAccent '\\"{i}' conceal cchar=ï
syn match texAccent '\\\~{i}' conceal cchar=ĩ
syn match texAccent '\\`{I}' conceal cchar=Ì
syn match texAccent '\\\'{I}' conceal cchar=Í
syn match texAccent '\\^{I}' conceal cchar=Î
syn match texAccent '\\"{I}' conceal cchar=Ï
syn match texAccent '\\\~{I}' conceal cchar=Ĩ
syn match texAccent '\\`{o}' conceal cchar=ò
syn match texAccent '\\\'{o}' conceal cchar=ó
syn match texAccent '\\^{o}' conceal cchar=ô
syn match texAccent '\\"{o}' conceal cchar=ö
syn match texAccent '\\\~{o}' conceal cchar=õ
syn match texAccent '\\`{O}' conceal cchar=Ò
syn match texAccent '\\\'{O}' conceal cchar=Ó
syn match texAccent '\\^{O}' conceal cchar=Ô
syn match texAccent '\\"{O}' conceal cchar=Ö
syn match texAccent '\\\~{O}' conceal cchar=Õ
syn match texAccent '\\`{u}' conceal cchar=ù
syn match texAccent '\\\'{u}' conceal cchar=ú
syn match texAccent '\\^{u}' conceal cchar=û
syn match texAccent '\\"{u}' conceal cchar=ü
syn match texAccent '\\\~{u}' conceal cchar=ũ
syn match texAccent '\\`{U}' conceal cchar=Ù
syn match texAccent '\\\'{U}' conceal cchar=Ú
syn match texAccent '\\^{U}' conceal cchar=Û
syn match texAccent '\\"{U}' conceal cchar=Ü
syn match texAccent '\\\~{U}' conceal cchar=Ũ
syn match texAccent '\\`{y}' conceal cchar=
syn match texAccent '\\\'{y}' conceal cchar=ý
syn match texAccent '\\^{y}' conceal cchar=ŷ
syn match texAccent '\\"{y}' conceal cchar=ÿ
syn match texAccent '\\\~{y}' conceal cchar=
syn match texAccent '\\`{Y}' conceal cchar=
syn match texAccent '\\\'{Y}' conceal cchar=Ý
syn match texAccent '\\^{Y}' conceal cchar=Ŷ
syn match texAccent '\\"{Y}' conceal cchar=Ÿ
syn match texAccent '\\\~{Y}' conceal cchar=
endif endif
endif endif