Edit LaTeX snippets in Sublime Text 3

1

In the following snippet of the package LaTeX (Sublime Text 3) every time I enter a espacio , * , ? or . in the part of :

label{sec:*********} y  % section ********* (end)

substitutes the characters mentioned by the underline _ .

<snippet>
    <content><![CDATA[
\section{${1:section name}} % (fold)
\label{sec:${2:${1/\\w+\{(.*?)\}|\(.)|(\w+)|([^\w\]+)/(?4:_:\L$1$2$3)/g}}}
${0:$TM_SELECTED_TEXT}
% section $2 (end)]]></content>
    <tabTrigger>sec</tabTrigger>
    <scope>text.tex.latex</scope>
    <description>Section</description>
</snippet>

So, my question is:

How can you modify the snippet to replace the vowels with a tilde with a vowel without a tilde?

That is: if you enter á , é , í , ó and ú that replace it with a , e , i , o and u .

    
asked by Robles 12.06.2016 в 08:15
source

1 answer

2

The regular expression allows you to capture the groups and specify the replacement of each, try the following snippet :

  

Note: I have placed capture groups up to number 6, if you want to add another replacement, add followed by pipe| other group (G) where G is the pattern to look for and then place the replacement at the end with the (?N:R) notation where N is the group number and R the replacement.

<snippet>
    <content><![CDATA[
\section{${1:section name}} % (fold)
\label{sec:${2:${1/(?:([^\w])|(á)|(é)|(í)|(ó)|(ú))/(?1:_)(?2:a)(?3:e)(?4:i)(?5:o)(?6:u)/g}}}
${0:$SELECTION}
% section $2 (end)]]></content>
    <tabTrigger>sec</tabTrigger>
    <scope>text.tex.latex</scope>
    <description>Section</description>
</snippet>
    
answered by 02.03.2017 / 23:13
source