Sublime Forum

Snippet with no leading space

#1

Hey everyone!

Let’s say I want to write
int[] i;

and I got
int i;

already and I got a snippet that tab triggers 5 to [], is there a way to just write int5, then tab trigger?

Best wishes,
Shu

0 Likes

#2

Well, you could set up:

<snippet>
    <content><![CDATA[int[]]]></content>
    <tabTrigger>int5</tabTrigger>
    <scope>source.java</scope>
</snippet>

And then you can just add a 5 to the int and press tab and it will expand out; of course you could also just type [] in that case, which is the same number of keys.

Unless I’m missing what it is you’re asking for?

0 Likes

#3

Thanks for the reply! Yes, I could do that, but my intent is to be flexible with the way I invoke snippets. The example may be trivial, but I have faced the core of this issue many times and I guess it wouldn’t make much sense thinking about any possible combination of non whitespace and any snippet that could follow.

0 Likes