Błażej Michalik
Błażej Michalik

Reputation: 5055

Sublime text 3: editing in-built code completion syntax

How to edit inbuilt code completion syntax in ST3?

For example: When I work on c file, I type

for

and hit tab, it gives me this:

for (int i = 0; i < count; ++i)
{
    /* code */
}

This hurts my code formatting, and my eyes, what I would like is

for (int i = 0; i < count; ++i){
    /* code */
}

Which file should I edit to do it when working with ST3 on Ubuntu?

Upvotes: 1

Views: 262

Answers (1)

MattDMo
MattDMo

Reputation: 102852

Please see my answer here for complete instructions on how to edit snippets in ST3. The package you are looking for is C++, and the snippet to edit is 030-for-int-loop-(fori).sublime-snippet. Change it to the following:

<snippet>
    <description>For Loop</description>
    <content><![CDATA[for (int ${2:i} = 0; $2 < ${1:count}; ${3:++$2}){
    ${0:/* code */}
}]]></content>
    <tabTrigger>for</tabTrigger>
    <scope>source.c, source.objc, source.c++, source.objc++</scope>
</snippet>

and you should be all set.

Upvotes: 2

Related Questions