Open sublime text 2 from command line on windows

In Mac, you can open sublime text 2 from terminal, and it’s really handy.

I wanted to replicate the same thing on windows, so wrote a simple script that enables it.
Once you run this script, you can do the following things from command line.

subl // this will open sublime text 2
subl . // open sublime text 2 with folder side bar.

For example, if you do it in c:\dev\trunk, sublime text will open with folder that is based on c:\dev\trunk.

To run the script, copy the below, and in the command prompt (not powershell prompt), right click and paste it. You must have powershell installed if you are not on windows 7 or Vista

REM Begin Copy
Set-Content "C:\Program Files\Sublime Text 2\subl.bat" "@echo off"
Add-Content "C:\Program Files\Sublime Text 2\subl.bat" "start sublime_text.exe %1"
if (!($Env:Path.Contains("Sublime"))) {[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";C:\Program Files\Sublime Text 2", "Machine")}
REM End Copy

You will have to close the command prompt as the path change would take effect when a new command prompt starts.

Open sublime text 2 from command line on windows

About sublime text 2

Another great text editor, free to everyone, but you can contribute to the project by paying for the license.

sublime text 2:

sublime packages

By installing sublime package control, you can benefit from diverse plugins.

package control installation:

List of community packages:

List of packages I use

Setting up build system

By setting up the build, you can easily run javascript tests or build sass.

Go to Tools -> Build System -> New Build System, and add your own build script. For example, mine is like this.


    "cmd": ["cmd.exe", "/c", "rake", "run_jstests", "build_section=files"],
    "working_dir": "YOUR_WORKING_DIRECTORY",
    "selector": "source.js"


You can look at the comprehensive keyboard shortcuts, yet the below are my favourites.

  • open console: ctrl + ‘
  • open command pallete: ctrl + shift + p
  • find in files: ctrl + shft + F
  • reveal in sidebar: unfortunately, no shortcut key yet. right on the view and select it
  • Quick-open files by name: ctrl + p
  • Go to word in the current file: ctrl + ;
  • Duplicate line(s): ctrl + shft + d
  • move line/selection up: ctrl + shft + up arrow
  • move line/selection down: ctrl + shft + down arrow
  • align variables declaration (alignment): ctrl + alt + a
About sublime text 2

Tools, libraries and patterns used at Huddle

Huddle uses extensive list of open source libraries and tools, and I love it.
This is the list of things I discovered so far.

Server side


scripting, build, …



To be continued …

Tools, libraries and patterns used at Huddle

running sublime text 2 on ubuntu

You can download sublime text 2.

I created a directory, “Applications” under Home. I extracted the downloaded tar in there. Then I did “Make Link” of sublime_text executable and put it into /home/bin, where $Path includes. I renamed the shortcut (excuse my windows terminology) to “subl”, so I can just type “subl .” to launch the editor.

“Unable to locate theme engine in module_path: “pixmap””
I run the editor and get this error.

sudo apt-get install gtk2-engines-pixbuf

Once you install gtk2…, the error will go away.

running sublime text 2 on ubuntu