Besides being lightweight, having a built in regular expressions engine, a console, built in syntax coloring for a variety of file formats and programming languages; it's also extensible.
One of my favorite extensions is the Package Control extension, by which you can add packages. One package that I found helpful was the Cheat Sheet package.
It allows you to use keyboard shortcuts to access existing cheat sheets that have already been created for you and allows you to create your own:
Command | Keyboard Shortcut |
---|---|
Bash * | Ctrl + Shft + C, S, H |
Git * | Ctrl + Shft + C, G, I, T |
Github Flavored Markdown * | Ctrl + Shft + C, G, F, M |
Go * | Ctrl + Shft + C, G, O |
KDE * | Ctrl + Shft + C, K, D, E |
Regular Expressions | Ctrl + Shft + C, R, X |
Sublime Text * | Ctrl + Shft + C, S, T |
* Incomplete sheet.
Create Your Own Cheat Sheet
Use the following for the package path:
Windows 7 - C:\Users\<user name>\AppData\Roaming\<your version of sublime text>\Packages\Cheat Sheets (e.g. C:\Users\jsmith\AppData\Roaming\Sublime Text 3\Packages\Cheat Sheets).
Use the following for the menu path:
Windows 7 - C:\Users\<user name>\AppData\Roaming\<your version of sublime text>\Packages\Cheat Sheets\Main.sublime-menu
Alternatively you can following to get the path: view.run_command("cheat_sheet_tester", {"cheatsheet": "$filename"})
Next follow the steps in How to Add Your Own Cheat Sheets or here:
How to add your own Cheat Sheets
How to add your own Cheat Sheets
- Add your cheat sheet to
$ST/Packages/User/cheat-sheets/$filename.cheatsheet
. - Add a keyboard shortcut by adding the following line to
$ST/Packages/User/Default ($OS).sublime-keymap
and change the keys and $filename:[ { "keys": ["ctrl+shift+c", "n", "s"], "command": "cheat_sheet", "args": {"cheatsheet": "$filename"} } ]
- Add a menu entry by adding the following to
$ST/Packages/User/Main.sublime-menu
and change both instances of $filename:[ { "id": "tools", "children": [ { "id": "cheat-sheets", "caption": "Cheat Sheets", "children": [ { "caption": "$filename", "command": "cheat_sheet", "args": {"cheatsheet": "$filename"} } ]} ]} ]
- Add a palette item to
$ST/Packages/User/Default.sublime-commands
and change both instances of $filename.[ { "caption": "Cheat Sheet: $filename", "command": "cheat_sheet", "args": {"cheatsheet": "$filename"} } ]
To add multiple cheat sheets copy and paste just the keys or caption line and add a comma in between each entry to all the above files. - Highlighting follows this format:
>\t Header >\t\t Subtext Text Command \t Text Command \s\s Text \tCommand \t Text # Comments
Where \t means tab and \s means space.
- If there's a problem, you can use the cheat_sheet_tester command. The tester command will print in the console the file paths where it expected to find your $filename. The console can be opened with
Ctrl + `
orView > Show Console
.The tester command can be run directly in the console with:view.run_command("cheat_sheet_tester", {"cheatsheet": "$filename"})
The tester command can also be run as a keyboard shortcut with:{ "keys": ["ctrl+shift+c", "r", "y"], "command": "cheat_sheet_tester", "args": {"cheatsheet": "$filename"} }
No comments:
Post a Comment