Hello, fellow code monkeys.
Look at your editor. Now back at mine. Now back at yours. Now back to mine. Sadly your editor is not like mine. But if you stopped using noob-scented editor, and switched to Sublime Text 2, your editor could look like mine.
Look down. Back up. Where are you?
You are on a desk with the editor your editor could look like.
What’s in your hand? Back at me. I have it! It’s a package control with several handy plugins that you would love. Look again. The plugins are now diamonds. Anything is possible when your editor looks like Sublime Text 2 and not Eclipse.
I’m on a horse.
Coming straight from the homepage of Sublime Text: “Sublime Text is a sophisticated text editor for code, html and prose. You’ll love the slick user interface and extraordinary features.”
0. It’s gorgeous
I probably can’t stress that enough - Sublime Text is the most beautiful editor I have laid eyes on. It has simple, clutter-free UI, and yet powerful functionalities. Before I switched I even created this Eclipse Sublime-Text-like color theme (it’s in top 20 most picked themes), because the syntax highlighting of the default theme is that awesome. Then, one happy day I just closed Eclipse and downloaded Sublime Text 2.
1. It’s blazing fast
I can open it and then close it for less than 10 seconds on my Mac OS X 10.7.2. For comparison, it takes me 2 minutes to do the same with Eclipse. Opening files, switching between files, searching in files and the whole project, switching between different projects, it is all amazingly fast. Just try it!
2. It’s updated pretty-much daily
You can have Sublime Text 2 if you download it from here. It is available for all the popular OS choices - OS X, Linux and Windows. The editor can be downloaded for free, however a license must be purchased for continued use. There is currently no enforced time limit for the evaluation.
However, in order to get the daily updates you gotta download the nightly/dev version from here: http://www.sublimetext.com/dev. You will not regret that.
3. ⌘ + P
I just love that! That’s my bread and butter.
Command + P (OS X) or Control + P (Linux/Windows) activates the magic. Press the combo and a drop-down appears.
Start typing and see how the files of your project jump in and out, that’s the fastest way to search for files in a project. The cool thing is not only it searches for the filename, but also the whole file path. So if you have a file - src/Controller/TestShizzle.php, and then search for "controller test", bam you have it! Furthermore, the search is quite forgiving when it comes to typos, which is neat.
So after you wrote "controller test", and Sublime Text focused the correct file then you can continue with "controller test@" which reveals the list of methods in that file. Cool, heh?
When you have opened a file:
- Command + P and then type ”@”, that gives you a list of all the methods in this file.
- Command + P and then type ”:” followed by a number, that jumps to the specified line number in this file.
4. Installing packages can’t be easier
First install Package Control from here. Restart Sublime Text and you are ready to go!
Shift + Command + P gives you another handy drop-down. Write "install" and an option “Package Control: Install Package” appears. Select it by hitting “Enter” and wait for the package list to load. Browse through it or simply search for a specific package. Easy!
When you install a plugin through the Package Control, it is being automatically updated to the newest version. Restart the editor after you install plug-ins in order to start using the goodies.
5. Git plugin
Install by following the instructions here: https://github.com/kemayo/sublime-text-2-git/wiki (Easy way to install: use Package Control: Install Package and search for "Git").
Use it. Shift + Command + P comes in use again. Shift + Command + P and write "git", you will see all the possible git commands you most probably use on a day-to-day basis. Shift + Command + P+ “git blame” + hit that “Enter” + punch the colleague that broke the sacred code. :) You have it all - git status, git pull, git push, git diff, you name it.
6. Code completion
A plugin which probably you will fancy: https://github.com/Kronuz/SublimeCodeIntel (Easy way to install: use Package Control: Install Package and search for "CodeIntel").
You use it by Control + Space, also you can explore classes and methods by clicking on them while holding the Alt key. Don’t despair! The first time you use the plugin it will need to build some indexes which can take more than a few seconds (depending on the size of your project). If $allOk === true then you are good to go.
7. Lint plugin
SublimeLint will hurt your feelings, but it will make you write better code: https://github.com/Kronuz/SublimeLinter (Easy way to install: use Package Control: Install Package and search for "SublimeLinter").
8. Many other goodies I use on a daily basis
- WordHightlight plugin is something useful: https://github.com/adzenith/WordHighlight
- Make the gorgeous, even more gorgeous with this funky Soda theme: https://github.com/buymeasoda/soda-theme
- Control + Command + P - switching between different projects
- 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