Handy Sublime Shortcuts

Posted on in Environment Sublime Text
  • Command + Shift + P - Opens the magic dropdown 😉
  • Command + Shift + P > Package Control: Install Package - go install nice plugins

  • Command + P > : - go to line number

  • Command + P > @ - gives you a list of all the methods in this file.
  • Command + / - commenting/uncommenting
  • Command + ] - Indent
  • Command + [ - Unindent
  • Control + Command + Up - move selected line up
  • Control + Command + Down - move selected line down
  • Command + Number - switches to an open tab. Command + 1 goes to the 1st tab, Command + 2 - 2nd tab, etc.
  • Shift + Command + F - searches through the whole project
  • Shift + Control + K - deletes selected code or line
  • Ctrl + ` - Opens Sublime console

(if you have JSHINT installed)
- Command + J - Run JSHint

Projects in Sublime Text 2

Posted on in Environment Sublime Text

Working with projects in Sublime Text 2 is less straightforward compared to any other editor or IDE.
Though it's easy to setup:

  1. Open Sublime
  2. File > Open (select project folder)
  3. Project > Add folder to project
  4. Select project folder and press ok.
  5. Project > Save project as
    2 files will be created: untitled.sublime-project & untitled.sublime-workspace

By default the sidebar view is hidden.
To enable the sidebar and view all open files:
View > Sidebar > Show Sidebar

Next time you can open your project with:
Project > Open Project > untitled.sublime-project

The untitled.sublime-project & untitled.sublime-workspace files allow you to make project/workspace specific configurations to Sublime.
You define multiple folder paths as well as specify folders and files you want to exclude from view. For example:

{
    "folders":
    [
        {
            "path": "wwwroot",
            "folder_exclude_patterns": ["images">
        },
        {
            "path": "c:wwwrootproject1assets",
            "name": "Project 1",
            "file_exclude_patterns": ["*.php">
        }
    ],
    "settings":
    {
        "tab_size": 8
    }
 }