简体   繁体   中英

Capitalising in Sublime Text 2 snippets

I am trying to set up snippets for getters and setters in C++. This is what I have:

<snippet>
     <description>getter</description>
     <content><![CDATA[
        ${1:(type)} get${2:(var)}() { return ${2:}; }
     ]]></content>
     <tabTrigger>getter</tabTrigger>
     <scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>

However, I like to use camel case. Is there a way in which to capitalise the first letter after “get” but not capitalise it in the return statement?

This works. First field will be type , fill that in, then tab to the next spot and enter your variable name.

<snippet>
     <description>getter</description>
     <content><![CDATA[
${1:type} get${2/./\U${0}\E/}() { return ${2:}; }
$0]]></content>
     <tabTrigger>getter</tabTrigger>
     <scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM