Recent Posts

Sponsors
![]() |
Sublime Text Editor for PHP - a love storyMike Peters, 01-24-2013 |
Sublime Text is a fast, sophisticated text editor for code.
Over the years we've tested numerous text editors, including Notepad, Notepad++, PHPStorm, Eclipse, jEdit, NetBeans, phpDesigner and PHPEdit...
Up until recently, PHPStorm and Notepad++ were our two favorites.
PHPStorm has a very extensive feature-set: syntax highlighting, autocomplete, refactoring, html wysiwyg mode, a built-in debugger and file indexing. But it's heavy. Slow. Bloated.
Notepad++ is fast, but it's missing a lot of the goodies found in PHPStorm.
Introducing Sublime Text
Sublime Text 2 combines the best of both worlds:
* Blazing fast
* Sexy
* Syntax Highlighting
* Code completion
* Multi-select and multi-edit
* Goto Anything
* Find and Replace in files
* Customizable via extensive plugin library

Installing
Step 1
Download the latest version of Sublime Text 2 here
Windows, Mac OS and Linux binaries are available.
Step 2
Install the Sublime Package Control, by launching the Sublime editor, selecting "View" - "Show Console" from the menu, then pasting this code directly into the console:
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')
Package Control is now installed. Close Sublime text editor and restart it for changes to take effect.
Step 3
Open Sublime text editor, click Ctrl-Shift-P and type "Install Package"
Search and install these packages, one by one. Simply type the package name and click it to install.
* SublimeCodeIntel
* SublimeLinter
* WordHighlight
* jQuery
* Prefixr
* Clipboard History
One other thing you're going to want to turn-on is the "Auto save" feature. Off by default, you can turn it on, by opening the "Preferences" - "Default" and setting save_on_focus_lost to true:
Step 4
Sublime PHP linter relies on PHP being installed on your machine.
If you haven't installed PHP earlier, grab it from windows.php.net
You'll want to get the Thread-safe ZIP version. Extract the ZIP file to a new "C:\Program files\php" folder.
Open Sublime editor Preferences menu, select the SublimeLinter Settings under "Preferences" - "Package Settings", locate the "sublimelinter_executable_map" block and enter the full path where PHP is installed.
For example:
Step 5
Install Soda-Theme to give Sublime a sexy dark look
Once installed, update your default theme under "Preferences" - "Settings" with:
Restart Sublime editor and you're good to go
Sublime Cheat Sheet
Over the years we've tested numerous text editors, including Notepad, Notepad++, PHPStorm, Eclipse, jEdit, NetBeans, phpDesigner and PHPEdit...
Up until recently, PHPStorm and Notepad++ were our two favorites.
PHPStorm has a very extensive feature-set: syntax highlighting, autocomplete, refactoring, html wysiwyg mode, a built-in debugger and file indexing. But it's heavy. Slow. Bloated.
Notepad++ is fast, but it's missing a lot of the goodies found in PHPStorm.
Introducing Sublime Text
Sublime Text 2 combines the best of both worlds:
* Blazing fast
* Sexy
* Syntax Highlighting
* Code completion
* Multi-select and multi-edit
* Goto Anything
* Find and Replace in files
* Customizable via extensive plugin library

Installing
Step 1
Download the latest version of Sublime Text 2 here
Windows, Mac OS and Linux binaries are available.
Step 2
Install the Sublime Package Control, by launching the Sublime editor, selecting "View" - "Show Console" from the menu, then pasting this code directly into the console:
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')
Package Control is now installed. Close Sublime text editor and restart it for changes to take effect.
Step 3
Open Sublime text editor, click Ctrl-Shift-P and type "Install Package"
Search and install these packages, one by one. Simply type the package name and click it to install.
* SublimeCodeIntel
* SublimeLinter
* WordHighlight
* jQuery
* Prefixr
* Clipboard History
One other thing you're going to want to turn-on is the "Auto save" feature. Off by default, you can turn it on, by opening the "Preferences" - "Default" and setting save_on_focus_lost to true:
"save_on_focus_lost": true,
Step 4
Sublime PHP linter relies on PHP being installed on your machine.
If you haven't installed PHP earlier, grab it from windows.php.net
You'll want to get the Thread-safe ZIP version. Extract the ZIP file to a new "C:\Program files\php" folder.
Open Sublime editor Preferences menu, select the SublimeLinter Settings under "Preferences" - "Package Settings", locate the "sublimelinter_executable_map" block and enter the full path where PHP is installed.
For example:
"sublimelinter_executable_map":
{
"php" : "C:\\program files\\php\\php.exe"
},
{
"php" : "C:\\program files\\php\\php.exe"
},
Step 5
Install Soda-Theme to give Sublime a sexy dark look
Once installed, update your default theme under "Preferences" - "Settings" with:
{
"theme": "Soda Light.sublime-theme",
"soda_classic_tabs": true
}
"theme": "Soda Light.sublime-theme",
"soda_classic_tabs": true
}
Restart Sublime editor and you're good to go
Sublime Cheat Sheet
Open Folder: Opens list of all files on a left pane
Ctrl-P: Quickly find any file under your project
Ctrl-F: Find
Ctrl-H: Find/Replace in current file
Ctrl-Shift-F: Find/Replace in files
Ctrl-M: Jump to closing bracket
Ctrl-Shift-M: Select all content of current bracket
Ctrl-Z: Undo
Ctrl-Y: Redo
Ctrl-G: Goto line
Ctrl-S: Save current file
Ctrl-R: Goto symbol / function definition
Ctrl-Shift-D: Duplicate line
Alt-Shift-2: Split to two panes (shift-1 back to one)
Ctrl-2: Jump to pane 2 (Ctrl-1 jump to pane 1)
Ctrl-Shift-L: Multi select
Alt-F3: Select all occurrences of current word for multi edit
Ctrl-P: Quickly find any file under your project
Ctrl-F: Find
Ctrl-H: Find/Replace in current file
Ctrl-Shift-F: Find/Replace in files
Ctrl-M: Jump to closing bracket
Ctrl-Shift-M: Select all content of current bracket
Ctrl-Z: Undo
Ctrl-Y: Redo
Ctrl-G: Goto line
Ctrl-S: Save current file
Ctrl-R: Goto symbol / function definition
Ctrl-Shift-D: Duplicate line
Alt-Shift-2: Split to two panes (shift-1 back to one)
Ctrl-2: Jump to pane 2 (Ctrl-1 jump to pane 1)
Ctrl-Shift-L: Multi select
Alt-F3: Select all occurrences of current word for multi edit
![]() |
Mike Peters, 01-30-2013 |
Update: Sublime Text 3 Beta is available here
Instant load times, built-in "Go to function definition", Improved multi-view panes and lots more goodies.
Only available to Registered (paid) users at the point of this writing.
Note: None of the plugins are compatible yet. But on the other hand, "Goto function definition" is now a built-in feature.
Instant load times, built-in "Go to function definition", Improved multi-view panes and lots more goodies.
Only available to Registered (paid) users at the point of this writing.
Note: None of the plugins are compatible yet. But on the other hand, "Goto function definition" is now a built-in feature.
|

Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments