Statement Completion for Dynamic languages in Sublime Text
This post describes how to configure Sublime Text in order to get statement completion for JavaScript, Python, (and perhaps PHP, RHTML, Smarty, Mason, Node.js, XBL, Tcl, HTML, HTML5, TemplateToolkit, XUL, Django, Perl, and Ruby).
After following the steps, statement completion will also work for Python projects installed in a virtualenv.
- Download Sublime Text from here.
- Install on Windows or OS X (it doesn’t really matter).
Install Package Manager
- Run Sublime Text
- Open the Sublime Text Console. This is accessed via the ctrl + ` shortcut.
- Paste the following command into the console (it has to be all in one line):
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
- Restart Sublime Text
We have just installed Sublime Package Control – A full-featured package manager that helps discovering, installing, updating and removing packages for Sublime Text 2. It features an automatic updater and supports GitHub, BitBucket and a full channel/repository system.
Configure Statement Completion
- Press ctrl + shift + p (Windows, Linux) or cmd + shift + p (OS X).
- Type Install Package and select it.
The Install Package command shows a list of all available packages that are available for install. This will include all of the packages from the default channel, plus any from repositories you have added.
- Select
SublimeCodeIntelfrom the list of packages.
Configure Statement Completion for Python projects in virtualenv
You may skip this if you are not using virtualenv.
- Create a
.codeinteldirectory at the root of the project - Create a
configfile (without any extension) inside the newly created directory.
{
"Python": {
"python": '~/Documents/Projects/VirtualEnvName/bin/python',
"pythonExtraPaths": ['~/Documents/Projects/VirtualEnvName/lib/python/site-packages',
]
},
}
Note that VirtualEnvName is the name of the virtualenv were the files of the project are located.
The project itself is in ~/Documents/Projects/VirtualEnvName/ProjectName
Statement Completion in action!
A screenshot for jQuery (note also the very cool theme)

Also,
A screenshot for Document Object Model
References: