This is just a handy place to store some plugins I wrote for Sublime Text 2. Feel free to use, edit, extend, or improve as you see fit. It'd be nice to have credit if you post your updated version online, but it's not required. Treat all of this as MIT-licensed.
Note: I'm using this particular repo not only as an online storage space for some scripts that I use, but also as a sort of personal portfolio-- as such, I don't have a section for issues, and I do not accept pull requests.
blame.py is a Git blame plugin. It takes selected lines as arguments and outputs the data into the console.
Copy blame.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)
Select text or click desired line(s), then activate.
I've added this to my User Key Bindings (⌘-⌥-b on a Mac):
{ "keys": ["super+alt+b"], "command": "blame" }
...and this in User/Default_(your OS)_Context.sublime-menu, which allows context menu access:
{ "command": "blame", "caption": "Blame…" }
googleIt.py is a Google looker-upper. It takes the scope of the file and appends it to a Google search of either the word under the cursor or the selected text.
Copy googleIt.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)
Select text or click desired word, then activate.
I've added this to my User Key Bindings (⌃-⌥-/ on a Mac):
{ "keys": ["ctrl+alt+forward_slash"], "command": "google_it" }
...and this in User/Default_(your OS)_Context.sublime-menu, which allows context menu access:
{ "command": "googleIt", "caption": "googleIt…" }
pep8check.py is a PEP 8 style guide plugin. It uses another Python program called pep8.py. It looks like this:
Copy pep8check.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)
Take a look through the code, and add or remove options that fit your needs. In the stock example, I have the following set up:
--repeat show all occurrences of the same error
--verbose print status messages, or debug with -vv
--repeat show all occurrences of the same error
--ignore=errors skip errors and warnings (e.g. E4,W)
--show-source show source code for each error
--statistics count errors and warnings
--count print total number of errors and warnings to standard error and set exit code to 1 if total is not null
Play around with the options until you get what you want.
This plugin is dependent on pep8, which you must install yourself. You can install, upgrade, uninstall pep8.py with these commands:
$ sudo pip install pep8
$ sudo pip install --upgrade pep8
$ sudo pip uninstall pep8
Or if you don't have pip:
$ sudo easy_install pep8
There's also a package for Debian/Ubuntu, but it's not always the latest version:
$ sudo apt-get install pep8
I've added this to my User Key Bindings (⌘-⇧-8 on a Mac):
{ "keys": ["super+shift+8"], "command": "pep8_check" }
...and this in User/Default_(your OS)_Context.sublime-menu, which allows context menu access:
{ "command": "pep8_check", "caption": "PEP8 Check…" }
settings_refresh.py is a ridiculously simple plugin. It saves your settings, which in effect, refreshes your changes, if any were made. I use this for tweaking my color scheme and then immediately seeing the changes.
Copy settings_refresh.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)
After editing / adding / deleting a setting, or Theme, or Color Scheme, activate to refresh the changes.
I've added this to my User Key Bindings (⌃-⌘-r on a Mac):
{ "keys": ["super+ctrl+r"], "command": "settings_refresh" }
generate_uuid.py will generate a UUID (uuid4, to be specific-- if you want to know more, or if you should edit this to use uuid1, read more here) or a series of UUIDs if you have selected multiple points.
Copy generate_uuid.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)
Activate to generate a UUID.
I've added this to my User Key Bindings (⌘-⇧-u on a Mac):
{ "keys": ["super+shift+u"], "command": "generate_uuid" }
Using the Mac OS X application Validator S.A.C. (separate installation required, see below), local_validate.py will locally validate the current XHTML / HTML file. Handy if you have no internet access, as well as saving some traffic to W3C's often-overloaded servers.
- Download Validator S.A.C. and copy to your Applications folder.
- Copy local_validate.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)
After installation, your browser may prompt you to select the default handler for x-validator-sac
. Select Validator S.A.C.
Activate to locally validate the current XHTML / HTML file.
I've added this to my User Key Bindings (⌃-⌥-v on a Mac):
{ "keys": ["ctrl+alt+v"], "command": "local_validate" }
This will allow you to select text in a Sublime Text 2 file, and have it read back to you. Macs only.
Copy speak_to_me.py into your ST2 User packages folder (Sublime Text 2 > Preferences > Browse Packages... > User)
Select some text, and activate by keypress.
If you do not select anything, the file's content in its entirety will be read.
I've added this to my User Key Bindings (⌃-⌥-s on a Mac):
{ "keys": ["ctrl+alt+s"], "command": "speak_to_me"}