Sublime Forum

SnippetX: like Xarg but with Sublime Snippets

#1

Hi!

I wrote a Sublime Text 3 plugin to take tabular data (think csv), and place each field in the placeholder of a snippet.

It works a lot like Xarg, but with Sublime Snippets instead of commands.

Usage example:

I’ve made it after receiving several csv files containing data that had to be updated in a database. The query was like this:

UPDATE table SET x = y WHERE x = z

With SnippetX you solve this with a Sublime snippet and a button click. The snippets content could be as follows:

UPDATE table SET $1 = $2 WHERE $1 = $3

SnippetX will fill the fields in based on the placeholders number. Placeholders can be out of order, used multiple times and contain default data (if the field contains no data then default is used, or the placeholder is left blank).

Regular snippets with this SnippetX as long as they have TabTrigger. Otherwise, there’s no special requirements. Snippets you use today will work with this plugin.

You can learn more about usage and see a demo from the github page. https://github.com/ColinRyan/SnippetX

1 Like

#2

Dang, I’m in love with this plugin. Also, it should be noted that the string that follows sx: is not the plugin name (at least not the name of the file) but the tab trigger text. Also, if using the plugin with custom snippets, your snippet must have the tab trigger section filled out (that’s an optional setting for snippets).

0 Likes

#3

Well thank you XD. I’m going to update the documentation. Looking back at it now, it’s pretty sparse. Thanks for the feedback!

0 Likes

#4

I updated my documentation based on your feedback. Thanks again!

0 Likes

#5

Great. I’m glad you wrote this plugin. I have a monthly task to generate some sql queries based off some csv data, and sublimes completion helps, but this plugin will save me a lot of typing.

0 Likes

#6

I just recently updated this plugin to allow the use of snippets belonging to one context (say, JS snippet) to be used in another (plain text). Also fixed a bug so that snippets in sublime-packages can also be used now.

0 Likes