Created
May 23, 2020 13:19
-
-
Save IvanWooll/1b3cbfe4abe4ad5340a04210be58e6aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sublime, sublime_plugin, re, string | |
class KdcformatCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
for region in self.view.sel(): | |
if not region.empty(): | |
s = self.view.substr(region) | |
news = s.replace('[', '[\n\t') | |
news = news.replace('(','(\n\t\t') | |
news = news.replace(', ',',\n\t\t') | |
news = news.replace(']','\n]') | |
news = news.replace(')','\n\t\t)') | |
news = news.replace('),','),\n') | |
self.view.replace(edit, region, news) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment