Sublime Text is a text editor for code, markup and prose.
Just download it from http://www.sublimetext.com/2 and unzip it where you prefer. In linux environmentes I usually do it on $HOME/bin/ as it’s reachable from path.
Sublime Text is highly extensible through plugins. There’s no centralized site for downloading them, but there’s an easy solution:
Sublime Package Control is a complete package manager for Sublime TExt 2 that helps us to search, install, uninstall and mantain packages.
Installation takes place on console: “View -> Show Console” and paste the following 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'
Once it’s installed, please relaunch the app.
To install any plugin, push Ctrl+Shift+P (Win/Lin?) or Cmd+Shift+P (OSX) and write “package“. The set of package related options will be filtered. To update the list of plugin package select “Discover Packages“. Once they’re updated, any package can be installed with the “Install Package” option
If you’re planning to use Sublime Text for Python development, pylinter is your plugin. It needs pylint already installed on the system (pip install pylint will do) and then update the path to the liny.py file on the plugin settings.
Once it’s installed you’ll get all code violation for your python code which can be hidden if needed.
Similar to the previous one, but applicable for other languages. I usually have Pylinter for Python code and this one for the rest.
Will show you the git status at the bottom bar and will let you interact with the DVCS.
DEBUGGING WITH SUBLIME TEXT AND PHP
This is a bit tricky.
sudo apt-get install php5-xdebug
Customize the xdebug settings with:
sudo gedit /etc/php5/conf.d/xdebug.ini
We will add the following settings to that file if not already present:
That will enable remote debugging for localhost in the port 9000. Restart Apache.
sudo service apache2 restart
INSTALL SUBLIMEXDEBUG PACKAGE
We will install SublimeXdebug? through Package Control.
Ctrl + Shift + P > install > Xdebug
Then restart your Sublime Text 2 and your system is already to start debugging.
Install the Chrome Xdebug extension and restart Chrome. There will be a new icon at the address bar where the plugin can be enabled/disabled; but first we need to adjust the extension to use the Sublime Text sessionkey.
In Chrome go to Tools -> Extensions
And open Xdebug Helper preferences and write down “sublime.xdebug” as the session key and enabled debugging only for localhost changing the domain filter.
In Sublime a new breakpoint can be added using Ctrl+F8 combo at the preferred line. Start debugging with Shift+F8 -> Start Debugging. Sublime will then wait for a remote debug connection.
In Chrome, navigate to the localhost page you want to debug and click on the Xdebug HElper button to set it green. Reloading the page will get it frozen; that’s because it’s already captured by Sublime.
- Shift+f8: Open XDebug quick panel
- f8: Open XDebug control quick panel when debugger is connected
- Ctrl+f8: Toggle breakpoint
- Ctrl+Shift+f5: Run to next breakpoint
- Ctrl+Shift+f6: Step over
- Ctrl+Shift+f7: Step into
- Ctrl+Shift+f8: Step out