-
Notifications
You must be signed in to change notification settings - Fork 407
Updated Check for Math Zone #1880
Copy link
Copy link
Closed
Description
For reference: since the new syntax highlighting, a Vimscript function InMathZone() that checks whether the cursor is in a math zone now has to take account of the new highlighting groups texMathRegions (in addition to the built-in ones texMathZones), that is,
let s:mathzones = '\%(texMathZone\%([A-L]S\?\|[V-Z]\)\|texMathRegion\%(\|Ensured\|Env\|EnvStarred\|X\|XX\)\)'
let s:textzones = 'texMathText\%(\|Arg\)'
function! InMathZone()
let ids = reverse(map(synstack(line('.'), max([col('.') - 1, 1])), 'synIDattr(v:val, ''name'')'))
let first = match(ids, '^' . s:mathzones . '\|' . s:textzones . '$')
return (first >= 0 && match(ids[first], '^' . s:textzones . '$') == -1)
endfunctionEdit: Take account of text zones in math zones.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels