-
Notifications
You must be signed in to change notification settings - Fork 393
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
Conceal additional commands like \section{} and \texttt{} #1978
Comments
:) (I personally don't like it, but I understand it is a popular feature!)
No plan except that I'll be glad to improve as suggestions are provided, such as this.
Ok, so:
Actually, no: syntax conceals only allow a single substitution character of the concealed text. In this particular case, we can conceal the % before
\section{sec}
\subsection{subsec}
% after
¤sec
#subsec The initial character can be chosen quite freely, but we can't add a space separator or use multiple characters. Thus, I'm not sure if concealing the |
By the way, conceal of |
The highlight group is just a name right? In that case
After some tinkering I was able to throw together this proof of concept that turns syntax region Statement start='\\section{' end='}' transparent contains=section1,section2,section3
syntax match section1 '\\\%(section.*\)\@=' contained conceal cchar=#
syntax match section2 '\%(\\\)\@<=section{\ze\w\+' contained conceal cchar= " space
syntax match section3 '\%(section{\w\+\)\@<=}' contained conceal
set conceallevel=2 I'm not sure what the neatest way of getting it to also handle |
This is now implemented in #2022; please test and give some feedback. I've also added a couple of questions that I'd like to hear opinions on. |
VimTeX conceals some commands like for instance
\textbf{}
,\textit{}
which I love.Is there any plan to conceal more commands? The ones that I personally miss the most are for
\section{}
/\subsection{}
/\subsubsection{}
and\texttt
.For
\texttt{}
I think that the surrounding command should be concealed and the text inside it should get a syntax highlighting.As for
\...section
, in order to differentiate between the different levels it could for instance get concealed into the markdown syntax like this:Without conceal:
With conceal:
Would this be possible to implement?
The text was updated successfully, but these errors were encountered: