Skip to content

Instantly share code, notes, and snippets.

@dfkaye
Last active December 16, 2015 08:38
Show Gist options
  • Save dfkaye/5406794 to your computer and use it in GitHub Desktop.
Save dfkaye/5406794 to your computer and use it in GitHub Desktop.
Sublime Text 2 cheat sheet for Windows - ST2 is amazing
These are my own commands, shortcuts, configurations for sublime text 2 on windows
There's also a really good one at http://www.sublimetext.com/forum/viewtopic.php?f=2&t=10615.
sublime text 2 documentation at
http://www.sublimetext.com/docs/2/
preferences
use vim?
remove "Vintage" from preferences:
"ignored_packages": ["Vintage"] => "ignored_packages": [""]
avoid clobbering prefs with each update?
save your customizations to Settings - User, not Default
save customizations to Key Bindings - User
commands
console: Ctrl+~
palette: Ctrl+Shift+P
find file: Ctrl+P (uses partial match or 'fuzzy search')
new file: Ctrl+N
save file: Ctrl+S
newline above: Ctrl+Alt+Up
newline below: Ctrl+Alt+Down
incremental search: Ctrl+I
commenting: Ctrl+/
multiple cursors
expand: Ctrl+D (expands cursor to surround current word)
quick add next: Ctrl+D
Undo Selection: Ctrl+U
Find All: Alt+F3
Edit All found: arrow to position, type new chars
select lines: Shift+Up/Down
edit selected lines: Ctrl+Shift+L, arrow to position, type new chars [ yes ]
TIP:
aFter Alt+F3, hit Esc, arrow to position, type, then Esc when done editing
column selection: Shift+right-mouse-button drag... [ haha ~ on my win 7, Ctl+Alt+Up toggled the entire viewport upside-down ]
browse symbols
Ctrl+R
Ctrl+P, then '@'
Ctrl+P, type filename (enough to pull target file to top), then '@'
keyboard
Alt+<letter> for menu - Alt+N opens preferences, e.g.
Alt+N, 'K' (key bindings)
save customizations to Key Bindings - User
package control
To install package control, see http://wbond.net/sublime_packages/package_control
Alt+N, C - opens package viewer - type 'install' to see installers for packages
Ctrl+Shift+P:
'install' - lists installers for packages
'list' - lists installed packages
'remove' - remove an installed package
AdvancedNewFile
(see https://tutsplus.com/lesson/lightning-fast-folder-and-file-creation/)
Ctrl+Shift+P, 'install' AdvancedNewFile
Ctrl+Alt+N: opens input for new file directory/path/file.name - will create subdirectories as needed.
prefixr
(see https://tutsplus.com/lesson/cross-browser-css-with-prefixr/)
snippets ("use them religiously" - jeffrey way)
all snippets are named <name>.sublime-snippet
snippets are stored in packages/user
TIP: save snippets in subdirs by language (packages/user/JavaScript, packages/user/python, etc.)
Alt+T, S - opens Tools > Snippets > all snippets in sublime text
Ctrl+Shift+P, 'snippet' > snippets associated with current file type
as you type, st shows snippets associated with symbols, if any
once you've selected a snippet, use tab insertion to replace the boilerplate
Alt+T, new snippet > generates snippet boilerplate:
<snippet>
<content><![CDATA[
Hello, ${1:here} is a ${2:snippet}.
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<!-- <tabTrigger>hello</tabTrigger> -->
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
This snippet is called by 'iife' and will generate an IIFE and place the cursor inside the function:
<snippet>
<content><![CDATA[
;(function() {
${1}
}());
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>iife</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
This snippet is called by 'scriptsrc' (thank you, Jeffrey Way) and will generate a script tag and place the cursor in the src attribute:
<snippet>
<content><![CDATA[
<script src='${1:src_goes_here}'></script>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>scriptsrc</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>
search github for SublimeText2 snippets
https://github.com/search?q=sublime+snippet&ref=cmdform
snippets & gists
install package gist
save customizations in Gist.sublime-settings USER
prefix gist snippets by language HTML: does this, CSS: does that
or set settings entry by gist_prefix or gist_tag (if supported) -
fork others' gists into your own gist-repo - one stop shopping
docblockr
code comment tool > package install docblockr
forward slash, two stars, tab... expands into comment block
tasks
toggle sidebar?
Ctl+K, Ctl+B
toggle the minimap?
Ctl+Shift+P, 'minimap', select toggle minimap
change syntax highlighter?
Ctl+Shift+P, 'syntax', select syntax <language>
select and edit multiple occurrances of "fester"
ctrl+F 'fester', arrow to position, Ctrl+D, Alt+F3, arrow to position, type new chars, Esc when done
Sidebar Enhancements (package) - open in browser, e.g.
Sublime Linter -
see here for setting node.js path: http://fuzzytolerance.info/blog/getting-sublimelinter-running-on-windows/
Ctrl+Shift+P, lint, disable linting, reset,
Manage Tasks with PlainTasks plugin
Ctrl+Shift+P, 'task' new document
type a header, end it with a colon:
Ctrl+Enter > adds an item
Ctrl+I > adds this item, creates new line for next item
@ plus chars creates a Tag
--Tab creates a divider
Select, Ctrl+D - toggles complete states
Ctrl+Shift+A - moves completed items to an archive section
http requests with HttpRequester
tl;dr from (https://coderwall.com/p/-j8gaw)
Use the package manager to install "Http Requester"
Select an URL with the cursor and Ctrl+Alt+R (or right click and "Http Requester")
Now you should see a tab "http response"
LiveReload
see https://tutsplus.com/lesson/livereload/
fetch files and packages
see https://tutsplus.com/lesson/fetch-files-with-ease/
Vintage Mode
Join Lines
Projects
Configuring and Mastering Split Windows
View > Layout | Move...
Alt+Shift+2 - split into two windows
Ctrl+Shift+2 - move selected file into into group 2
Toggle cursor btwn groups: Ctrl+1, Ctrl+2 ...
Custom Builds
https://tutsplus.com/lesson/custom-builds/
Tools > Build System >...
example coffeescript.sublime-build
{
"cmd" : ["coffee", "-wc", "$file"],
"selector" : "source.coffee",
"path" : "/usr/local/bin"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment