Sublime Text

From Logic Wiki
Jump to: navigation, search


Shortcuts

Some Shortcuts

Ctrl+Shilf+L  : Edit multiple lines

Ctrl+Left Click  : multiple cursors

Ctrl+Shift+F11  : Distraction Free Mode

Ctrl+Q  : To start recording and stopping a macro

Shift+Alt+[1,2,3] : Split screen to 1,2,3

Ctrl+Shift+[  : Fold code

Ctrl+Shift+]  : Unfold code

Package Control

install it from https://sublime.wbond.net/installation

or ctrl + ' and paste the code below (for sublime text 3)

import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; 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://sublime.wbond.net/' + 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)

Usage

Ctrl + Shift + P to open control palette

Type Package Control to install packages


Formatting XML & JSON

First you need to download and extract tidy_xml.zip to sublime's User Packages folder. The easiest way to get there is to go to the "Sublime Text 2" menu, select "Preferences... " and then select "Browse Packages...". This will open a folder in the Finder.

In that folder, there is a subfolder called "User". Place the two python files in there.

To add a shortcut click "Preferences" and finally "Key Bindings - User" and enter these lines there

[
    { "keys": ["super+shift+x"], "command": "tidy_xml" },
    { "keys": ["super+shift+j"], "command": "prettify_json" }
]

These two shortcuts will enable the formatting of XML and JSON. To format XML, press WIN + SHIFT + x and the currently loaded XML will be nicely formatted and indented. Press WIN + SHIFT + j to format and indent a JSON file.