Home Download Buy Blog Forum Support

Split structured text (eg json) or Save Selected

Split structured text (eg json) or Save Selected

Postby mrdale on Wed May 07, 2014 7:17 pm

Is there a way to easily/automatically split structured text (eg.JSON) into smaller single files. Failing that, is there a "Save Selected Text" plugin floating around?

This would save me a ton of time.
mrdale
 
Posts: 4
Joined: Wed May 07, 2014 6:56 pm

Re: Split structured text (eg json) or Save Selected

Postby tito on Thu May 08, 2014 11:39 pm

Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Split structured text (eg json) or Save Selected

Postby mrdale on Fri May 09, 2014 5:03 pm

Ha! Just checked back to see if anyone was listening... Awesome, I'll check it out...

UPDATE: Can't seem to install on 3 from Package Install, what am I doing wrong?
mrdale
 
Posts: 4
Joined: Wed May 07, 2014 6:56 pm

Re: Split structured text (eg json) or Save Selected

Postby tito on Fri May 09, 2014 11:22 pm

Ahh, yes it needs to be included in the Package Control Channel. Let me check
https://github.com/wbond/package_contro ... /pull/3213
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Split structured text (eg json) or Save Selected

Postby mrdale on Wed May 28, 2014 8:16 pm

Can't seem to edit the key-bindings to ive this one a shortcut...

tried....

Code: Select all
{ "keys": ["super+shift+s"], "command": "Copy_To_New_Files" }


to no avail... help?
mrdale
 
Posts: 4
Joined: Wed May 07, 2014 6:56 pm

Re: Split structured text (eg json) or Save Selected

Postby tito on Wed May 28, 2014 10:28 pm

The "command" name is inside the file Commands.sublime-commands
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay

Re: Split structured text (eg json) or Save Selected

Postby mrdale on Thu May 29, 2014 7:16 pm

Excellent. Took me a while (total newbie) to stop hunting for a file called "Commands.sublime-commands" on my hard disk and look at the source for your package. Now all good!

I wonder if a mechanism to automatically split text into multiple files based on a regex pattern might be beneficial to anyone else... ie...

1. user builds a regex pattern
2. user tests the selection a few times
3. user invokes the "split to files" command
4. 1+ files are produced from search results in a designated directory

course, I have no idea how to do that... hint, hint ;)
mrdale
 
Posts: 4
Joined: Wed May 07, 2014 6:56 pm

Re: Split structured text (eg json) or Save Selected

Postby tito on Thu May 29, 2014 9:21 pm

Its easy.. just requires time.. take a look to the current approach https://github.com/SublimeText/Selectio ... Package.py
(hint hint) :)
Give APIs, let the community build the rest!
https://github.com/titoBouzout
tito
 
Posts: 855
Joined: Thu Sep 29, 2011 2:27 pm
Location: Montevideo, Uruguay


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 5 guests