Sublime Forum

What snippet code to use for this expansion?

#1

The snippet at the end of the post expands to _{} with cursor inside the curly braces when I type ll and press the TAB key.
It however works only if ll has space before it. For example, typing xll and pressing TAB key will not give x_{}. How can I achieve this?

<snippet> <content><![CDATA[ _{$1} ]]></content> <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> <tabTrigger>ll</tabTrigger> <!-- Optional: Set a scope to limit where the snippet will trigger --> <scope>text.html.basic</scope> </snippet>

Also, is there a way to have snippets expand without the TAB trigger?

Thanks for your help.

0 Likes

#2

Don’t have a solution for you off the top of my head, but just to let you know, the tab triggers for snippets represent whole words (with whitespace around them). That’s why ll<tab> works for you, but xll<tab> doesn’t.

0 Likes

#3

No one knows how to do this. Do you know if it is even possible?

Thanks.

0 Likes

#4

[quote=“curiouslearn”]No one knows how to do this. Do you know if it is even possible?

Thanks.[/quote]

Hey. Just wanted to let you know, by default, these two requests are not possible. HOWEVER, I have a plugin in the works that will allow for these things and more. I know it’s not exactly what you want to hear, but if you’re patient, it will be awesome.

I love all these posts where I can promote my upcoming plugins :smile:

slips curiouslearn $20 under the table…

0 Likes

#5

Huh? This can be fixed via a plugin??? :open_mouth:

Can you also fix snippets jumping bug? :smiley:
( if you have margin:${1:$2 $3 $4 $5}; and you erase the initial selection, you actually have to press tab 4 more times)

Either way, i can’t wait!

0 Likes

#6

WAYYYY ahead of you :wink:

0 Likes

#7

OMG! Marry me! :astonished: :smiley:

Don’t you need a beta tester? :stuck_out_tongue:

0 Likes

#8

You can add to key bindings something like this:

{ "keys": "alt+e"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Snippet: "} }

to call snippet
also with this hotkey you can wrap selection with the snippet using

$SELECTION
0 Likes

#9

Thanks for the replies.

@COD312 Eagerly awaiting your plugin. Do you have any idea on how long it will take?

@Sinled Thanks for the suggestion. I am not sure how to use your solution for inserting snippets. Do I need to use the `show_overlay’ command, or is that just an example? I will try to figure it out.

0 Likes

#10

That’s hard to say. I’m really busy this week until Friday. Then my schedules pretty free to work on it. I still have 2 pretty big features I want to add and a couple of bugs to fix. That shouldn’t take too long since I have everything figured out. The real problem is I keep coming up with so many new ideas for things to add :smile:. Then I’ll release a beta to get some feedback before a general release on Package Control. If I had to guess on an eta, I’d say early to middle of next week for the beta.

0 Likes