Home Download Buy Blog Forum Support

Exec Parser: Parse the content before you paste or duplicate

Exec Parser: Parse the content before you paste or duplicate

Postby edankwan on Tue May 21, 2013 6:46 pm

Exec Parser

https://github.com/edankwan/Exec-Parser-Sublime-Plugin

What it does is super simple - Run a python script file to parse the text. It is my first plugin and it is also my time using Python. Hope you guys like it and file issue on github to help it grow. It is already on Package Control. Try searching "Exec Parser" and you will get it :-)

By default, there are 6 default commands you can use after you installed it:

Code: Select all
[*]none - Do nothing
[*]dash-case - Convert to dash case
[*]snake_case - Convert to snake case
[*]camelCase - Convert to camel case
[*]X to Y - Convert X to Y, Width to Height and so on
[*]Swap equal positions - Change var a = b; into var b = a;


By default, the commands for copy/duplicate line are both "none", I recommend you to change the default hotkeys of them to the native ones as if you dont use any special commands, it can behave exactly like the native ones.

Default hotkey for paste command is Ctrl+Shift+v and for duplicate line command is Ctrl+Shift+c

Let 's say you want to use "X to Y" command for duplicate line, hit Ctrl+Shift+x to call out the command list panel. select "X to Y" > enter > duplicate only. Then when you try to duplicate the line:

Code: Select all
var width = x + containerWidth;

It will become:

Code: Select all
var height = y + containerHeight;

Awesome right?

But the coolest part of this plugin is not just the default commands. You can create your own commands as well.

Create your own command

Let 's say you want to create a command to wrap the context with bracket []. Hit "Ctrl+Shift+z" to call out the "user option" panel, choose "add new command", type in a filename without extension for example: "bracket-wrapper". Hit enter, it will open 2 files: commands.json(for name,description,...) and a python script file. Type the following line in the python file:

Code: Select all
output = '[' + output + ']'

Save it and hit "Ctrl+Shift+z" again to call out the "user option" panel, choose "Reinitialize Plugin". Then you will find that there will be a new command in the command panel.

Easy enough! For more information, just check out the github repo: https://github.com/edankwan/Exec-Parser-Sublime-Plugin

Please share your awesome command by making a pull request :)

Edan
edankwan
 
Posts: 1
Joined: Tue May 21, 2013 6:11 pm

Return to Plugin Announcements

Who is online

Users browsing this forum: kapooostin and 9 guests