Sublime Text 2 Shortcuts

Show PHP function list
  • CTRL+r
Clean up code
  • CTRL+ALT+t : HTMLTidy
  • CTRL+ALT+E : Encode special characters
Tag completion, folding
  • CTRL+. : close tag
  • CTRL+SHIFT+[ : Fold Code
  • CTRL+t : Fold Tag Attributes
  • <tag + TAB = autocompletion, e.g. <a + TAB = <a href=””></a>
  • <tag> + ALT + . = autocompletion, eg. <a> + ALT + . = <a></a>
Find in file(s)
  • CTRL+F : Find in file
  • CTRL+SHIFT+F : Find in files (or right click on folder and click Find in Folder)
  • CTRL+H : Find and replace in file

HOSTS File: Change an External Domain to Point Somewhere Else

If you update your hosts file to point a domain to another location, accessing that domain will take you to your new destination. For example, in Windows, your hosts file is at

C:WindowsSystem32driversetchosts

If you add the following:

127.0.0.1 www.google.com

and then open your browser and go to www.google.com, you will not see Google’s home page but rather your local host index page.  This can be handy when you want to disable one javascript include in a page that you don’t have access to. By pointing the external javascript domain to your local host, a 404 not found will be triggered which will prevent the code from running. Everything else, including other references to external javascript files,  in the page will still continue to execute.