I have a number of email templates for use inside mailchimp that are currently using standard merge tags, ala *|SUBJECT|*
. I want to convert these templates for Handlebars usage.
I can easily use %sno/*|/{{
and %sno/|*\}}
to swap the tag delimiters, but this leaves me with all-caps names, like {{SUBJECT}}
. Is there a good command for forcing lowercase inside of double curly braces in VIM so I don't have to hunt down and change every single variable?
Quicker problem description:
I have a lot of situations like this in an email template:
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>*|SUBJECT|*</title>
I instead want this:
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{subject}}</title>
What are the VIM commands I need to get there?
How about doing all that in one go?
:%s/\*|\(.\{-}\)|\*/{{\L\1\E}}/g
See :help sub-replace-special
.