-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to understand "g:vimtex_syntax_custom_envs" #3034
Comments
i read #2745 but im not sure if i should add relation tag to that |
In this context, a region is the syntax group used to match the defined region. Sorry, I couldn't help it. :p Now, "a defined region" here refers to the syntax region, which is one of three types of syntax items supported in the legacy syntax engine. See Vim understands three types of syntax items:
1. Keyword ...
2. Match ...
3. Region
This starts at a match of the "start" regexp pattern and ends with a match
with the "end" regexp pattern. Any other text can appear in between. A
"skip" regexp pattern can be used to avoid matching the "end" pattern.
You can do
So, I think you may need some more context to understand this thing. For each item in
Yes, more or less. You can make a custom environment rule that would allow to highlight the env content as another language.
This environment is very complex, and I'm not sure that you will be able to match it properly with \begin{sectionBox}OPTS{Title}
contents here
\end{sectionBox}
% OPTS: a sequence of characters, never empty
% {Title}: title (mandatory) If I'm right, then you could make a rule similar to this in syntax match texSectionBoxEnvBgn "\\begin{sectionBox}"
\ nextgroup=texSectionBoxOpts skipwhite skipnl
\ contains=texCmdEnv
syntax match texSectionBoxOpts "[s123bm]\+"
\ contained
\ nextgroup=texSectionBoxTitle skipwhite skipnl
call vimtex#syntax#core#new_arg('texSectionBoxTitle')
highlight def link texSectionBoxOpts texOpt
highlight def link texSectionBoxTitle texPartArgTitle |
Description
Hello there, im trying to learn how to define custom envs, and im having some difficulty understanding the documentation on
g:vimtex_syntax_custom_envs
What is a region, where can i see the existing regions so i can match what is expected.
i read
:help syn-region
but still am quite confused what region stands for here, what kind of options should i provide? same for "contains"im not sure if im understanding this right but this means what kind of language should be inside the environment
im trying to cross-over some environments that i used to neovim, maybe we could define one environment as example:
this is the sectionBox that simply organizes a single environment that defines if its a section, subsection or subsubsection, if its starred or not, puts inside a minipage if no
m
is specified, puts inside a tcolorbox if nob
is inserted.this is an example how its used:
i tried defining in vimtex like this so far, im clueless how else i should specify.
Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
no
VimtexInfo
not applicable
The text was updated successfully, but these errors were encountered: