Sublime Forum

Split structured text (eg json) or Save Selected

#1

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.

0 Likes

#2

Done github.com/SublimeText/SelectionsToFiles :slight_smile:

0 Likes

#3

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?

0 Likes

#4

Ahh, yes it needs to be included in the Package Control Channel. Let me check
github.com/wbond/package_contro … /pull/3213

0 Likes

#5

Can’t seem to edit the key-bindings to ive this one a shortcut…

tried…

{ "keys": "super+shift+s"], "command": "Copy_To_New_Files" }

to no avail… help?

0 Likes

#6

The “command” name is inside the file Commands.sublime-commands

0 Likes

#7

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 :wink:

0 Likes

#8

Its easy… just requires time… take a look to the current approach github.com/SublimeText/Selectio … Package.py
(hint hint) :smile:

0 Likes