Sublime Text
Sublime Text 3 was written by Jon Skinner. It's a commercial text editor written in C++ and its license costs about $80. You can also try the editor for an unlimited amount of time. However, without the license, a dialog box can appear from time to time when saving a file, encouraging to buy a license.
Sublime Text is a multi-platform, clean, efficient, and fast code editor. Its organized user interface is inspired by Vim. The editor supports a lot of programming languages and highlights their syntax. It has a really big community which creates various extensions for it, such as plugins, snippets etc.
By the way, which of your text editors can turn on and off under 2s? I think that Eclipse and similar IDEs can do that in like 2 minutes.
The editor contains cool features such as a full screen mode, but also a distraction-free mode in which everything except the code editor and the menu disappears. However, I didn't personally become I fan of the distraction-free mode. The editor can divide the workspace into up to 4 screens side by side (horizontally), 3 underneath (vertically) or 2x2. This is useful for large screens or to present your code while avoiding to switch between files.
Sublime Text has a really stylish code minimap that you'll love once you get used to it. But if you don't need it, you can change it, as well as anything else. The editor also includes a Python console that works very well, at least as a calculator.
Sublime Text is fully configurable. All configurations take place in special JSON files.
The editor behaves like any other graphical editor, but if you learn to work with keyboard shortcuts, it can be effectively controlled just by the keyboard. The key feature is the ability to control multiple text cursors at the same time. I have to say that this is a really cool thing and many other features are based on that ability. Similarly, you can use the CTRL + D keyboard shortcut. Once you select a part of the code, this shortcut will select other occurrences which you can work further with.
So how does the editor look like?
Keyboard shortcuts
There are really a lot of keyboard shortcuts, so we'll show some of the most used ones.
- Ctrl + P - server basically for file selection, if you add :, it moves you to the line, if @, it shows the function list
- Ctrl + Shift + P - the command list
- Ctrl + D - adds a cursor to the next occurrence
- Ctrl + Click - adds a cursor at the selected place
- Shift + Alt + 1, 2, 3, 4, 8, 9, 5 - splits the workspace
- Ctrl + F - searches in the current file
- Ctrl + Shift + F - searches in multiple files, pressing enter shows you the results
- Ctrl + Shift + up/down - moves the line up/down
- Ctrl + Shift + D - duplicates the line
- Ctrl + Shift + K or Shift + Delete - deletes the line
- Ctrl + (Shift) + Tab - moves to the next opened file
Plugins
To use plugins, we need Package Control. It can be easily installed by opening the console (Ctrl + ;, the key under Esc) and inserting the code from https://sublime.wbond.net/installation#st3.
Now a new option appears in the command list (Ctrl + Shift + P), "Package Control: Install Package". After activating the command, you'll see a window where you'll type the name of the plugin. An online plugin search engine can be found at https://sublime.wbond.net.
It's recommended to restart the editor after installing any plugin. We'll describe some interesting plugins now.
Alignment
A plugin that aligns the selected code to a more neat and readable form.
Original code
let a = "ICT.social"; let alpha = 231452354327; let usa = true; let ictSocial = "awesome social network for programmers";
After first usage
let a = "ICT.social"; let alpha = 231452354327; let usa = true; let ictSocial = "awesome social network for programmers";
After second usage
let a = "ICT.social"; let alpha = 231452354327; let usa = true; let ictSocial = "awesome social network for programmers";
Colorpicker
A great plugin if you want to use the classic color picker.
Emmet
Emmet (formerly known as Zen Coding) is an HTML plugin that generates an HTML
structure based on CSS-like selectors. Additionally to the CSS selector syntax,
you can also use multiplication, the $
character for
incrementation, {text}
to fill the content with text etc. You can
use brackets ()
to create expressions as well.
Launch the plugin by pressing Ctrl + Alt + Enter.
SidebarEnhancements
A great plugin for expanding file options.
SublimeCodeIntel
One of the most useful plugins. Auto-completes available functions and methods, moves you to the function definition by pressing Alt + Clicking on a function name, even if it's in another file. However, the plugin has some drawbacks as well.
Soda theme
This plugin will make your Sublime Text dark. Try to use their modified Monokai highlighter, which can be found at http://buymeasoda.github.io/soda-theme in the Bonus options.
Spacegray theme
Spacegray is also very popular theme. You can find the installation guide on Github - https://github.com/kkga/spacegray.
Snippets
Snippets are code pieces that you can paste from the command list. E.g. an HTML skeleton, lorem ipsum, etc. Sublime contains several snippets and if you want to use your own, there's no problem creating them.
Creating snippets is quite simple. You can create a new snippet in the tools -> developer -> new snippet tab.
The main element is <snippet>
where
<content>
is inserted. In the content, the snippet body is
written between
<![CDATA[ ... text ... ]]>
When creating a snippet, you should see a template that greatly simplifies the entire process.
Several settings can be placed below the <content>
element:
<tabTrigger>your-identifier</tabTrigger> <description>My description</description> <scope>text.html</scope>
tabTrigger serves as an identifier, i.e. as the command that creates your snippet. scope limits the snippet to files of a given type, for example by a file extension. description is used to describe the snippet in the command list (Ctrl + Shift + P**).
You can find examples of how to set scope restrictions at https://gist.github.com/…bhas/4705378
Conclusion
Sublime Text is surely a great editor with lots of quality plugins which add bonus points for the editor. Recently, however, web editors such as Atom or VSCode became available are getting into the game. We can now only guess which one will become the editor number one
If you're a bit more demanding and you need a tool that really understands the code, try looking for IDEs (which are basically editors that really understand the code) from JetBrains, e.g. IDE like PhpStorm, which I highly recommend.