Examples of sublime text3 formatting json and formatting sql code
This article mainly introduces sublime text3 formatting json and formatting sql code examples, the article introduces in great detail, has a certain reference value, interested friends must read it!
1. Format json text
Step 1: use the shortcut keys View- > show console (View-> Show / hide console) or (Ctrl+ `) to open the console, copy the following code, and enter, and then restart sublime--. For more information, please see: https://packagecontrol.io/installation#st3
Import urllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' +' ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path (); urllib.request.install_opener (urllib.request.build_opener (urllib.request.ProxyHandler (); by = urllib.request.urlopen (' http://packagecontrol.io/' + pf.replace ('','% 20'). Read (); dh = hashlib.sha256 (by). Hexdigest () Print ('Error validating download (got% s instead of% s), please try manual install'% (dh, h)) if dh! = h else open (os.path.join (ipp, pf),' wb') .write (by)
Step 2: install the pretty json plug-in
Method 1: click preferences-> Package Control- > enter install package, enter-> wait a minute, type Pretty json in the box that appears, enter enter, and then install
Method 2: shortcut key ctrl+shift+p, and then the same: enter install package, enter-> wait a minute, type Pretty json in the box that appears, enter enter, and then install
Step 3: shortcut key ctrl+alt+j to format json text
two。 Format sql code
Same as above, install the SqlBeautifier plug-in
Then: first ctrl+k, then ctrl+f for formatting
The above is all the content of the article "sublime text3 formatting json and formatting sql code". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!