
A couple of months ago, I accidentally
stumbled upon a lot of positive feedback about the text editor
Sublime Text 2 . Having tried it in business, I was not disappointed. Now this is my main work tool.
Sublime Text 2 is a paid text editor written in C ++, which:
- Runs on Linux, OS X and Windows
- It has a decent speed
- Nice interface (including all kinds of animations)
- Flexibly customizable (though not in the GUI, but in the json-configs)
- It has many plug-ins, the number of which is growing by leaps and bounds
- Supports VIM mode
- Uses fuzzy search
Price issue
The editor is shareware or “shareware” :)
It costs $ 59 per license (if you take a lot at once, there is a discount), but you can use it for free. In the free mode, once a couple of hours, a dialog box pops up with a suggestion to purchase an editor, and caps is written in the caption of the window at UNR right. As far as I know, there are no other differences.
')
Interface
One of the first impressions of the program is that it is beautiful out of the box. Correctly chosen fonts, color scheme, smooth animations (there are more of them here than in most text editors and IDE). All this makes sense, because in the end, it pleases the eye and does not distract attention. As long as the editor is not overloaded with plug-ins, it has a very fast response, which I managed to get rid of using NetBeans.

The first thing that catches your eye is the absence of any toolbar. Also, I have not yet encountered a single dialog box, except for the standard windows for saving / opening a file. Instead of dialog boxes, “layers” are used. Space characters and tabs are displayed only when text is selected, but in the settings you can set the “always” mode.
Right on the board is
a code card . A peculiar analogue of scrolling the page in the form of a pixel-map, which is the code of the current file compressed to ~ 100px horizontally (including syntax highlighting). Helps to navigate through the file, and also makes it easier to scroll the page, because acts like a scrollbar. It is difficult to say “killer feature” or the next “whistle”, but during the whole period of use I didn’t have a desire to remove it.
On the left side of the board can be a
panel of the project and
open files (View -> Side bar -> Show side bar). The project pane is a tree of directories connected to the project with simplified file manager features (for example, you can create new files / folders, rename and delete,
but you cannot move #UPD, there is a rename ). The panel of open files did not seem to me superfluous or unnecessarily duplicating the functionality of the tabs. Tabs are more familiar, but when there are too many of them, it is easier to find the one you need by name in this panel.
Fullscreen mode (F11) and "
Distraction Free Mode " (Shift + F11) are available. With the first, I think everything is clear, but the second was new to me. This mode is a full-screen mode with its own settings. For the first time going into it, only the code editor itself and the menu bar are available to you. In it (in -> View) you can enable / disable all the necessary / extra. Convenient mode for deep immersion in work.
Vertical selection mode is one of the most important functions for advanced text editors. And sublime is no exception. In the Linux version, it is activated by the right mouse button while the cipher is clamped. Very handy with quick edits of all sorts of lists, markup and more. It is worth noting that ST2 can search and replace by regular expressions, without which it would be difficult to consider it seriously.
Also worth mentioning is the
horizontal scroll . If your mouse doesn’t have it, use shift + vertical scroll. As it turned out - very convenient. In the status of the panel, in addition to errors and the current cursor position, the switches of the current file syntax and tab-a size are available.
Button icons for expanding / collapsing code regions (functions, blocks, tags, etc.) are somewhat unclear. The fact is that although they are located, as they should, to the left of the line of code, but, by default, they are displayed only when the mouse is moved (this is configurable). Available for many structures, in particular, very pleased with the possibility of "folding" SCSS-selectors.
Sublime provides plenty of options for
multiple selection and editing. Those. You can set the cursor in several places at once and edit the code synchronously (macros, autocomplete, snippet, clipboard, etc. will work at the same time). I really missed this in Netbeans. You can set a new cursor position via ctrl + left_mouse_click. Or ctrl + left_double / _triple click (select the entire word / paragraph). These and other shortcuts and mice are flexible and customizable.
Fuzzy search

One of the most advertised functions of the editor is fuzzy search. It allows you to find “modules / gallery / view / gallery / page.jade” by typing only “gapaja”. To say that it saves time is to say nothing. In 99% of cases, I open the files or find the function I need in this scraps, resembling some East Asian dialect :) From the box are available:
- Ctrl + P - search in project files
- Ctrl + R - search by function (by template-s in XSLT, selectors in CSS / SCSS, etc.)
- Ctrl + Shift + P - search through the menu (and new functions from plug-ins get into it, i.e. it is not necessary to remember hot keys for rarely used features)
- Ctrl +; - search by words. For example, by driving dbr, you can find where you forgot to remove the service debugger in the js file
- Ctrl + G - line number (not fuzzy-search, but, I think, this is where it belongs)
After playing with these combinations, you can pay attention to the fact that these modes can be combined. For example, having hammered in gapaja @ gallery_list, we will get not to the beginning of the file, but directly to the mixin-gallery_list.
This list can be expanded with plugins. About a couple of these, I will tell below.
Configuration
All settings are made through editing json-configs. Changes take effect immediately after saving the file. Most of the settings that you can get (whether the editor itself or its plugins) are divided into 2 parts - default and user. Those. the end user should change user-configs, which, by default, are usually empty.
You can see the basic editor settings by choosing Preferences -> Settings-Default from the menu. I will run on the most key:
- word_separators is an expression for word separation. For example, if you double click on a PHP variable, it is highlighted along with $, you can correct this option like this - "./ \\ () \" '-:,.; <> ~! @ #% ^ & * | + = [] {} `~?"
- fade_fold_buttons - display fold-icons (opening / hiding regions of code) only when you hover the mouse
- tab_size , translate_tabs_to_spaces - tab-a size and the ability to use spaces instead of tabs
- folder_exclude_patterns - an array of masks for files / directories that will be ignored when working on projects
- trim_trailing_white_space_on_save - trim leading spaces when saving
- show_tab_close_buttons - show "crosses" on tabs
- draw_white_space - show space and tab characters always or only when text is selected
- save_on_focus_lost - automatically saved when another file is selected or the editor loses focus
- default_encoding - the default encoding is “UTF-8”
- fallback_encoding - the encoding in case it was not possible to determine automatically
- auto_complete - on / off “autocomplete”. Because ST2 is not IDE, the autocomplete out of the box works on the principle - “here's all the words on the page, choose what you want.” Many do not like it.
- hot_exit - by default, the editor is closed without confirmation of saving / non-saving changed files. It simply remembers their condition and opens as if it did not close at all. The same behavior when switching projects. This option allows you to set the standard mode.
- close_windows_when_empty - close the program when closing all files
- preview_on_click - by default, when a file is selected in the project tree, it does not create a separate tab for it, but simply shows it over the current file. You can make a couple of changes and save. If you want to open the file "full", then you need to double-click. This option is responsible for this behavior.
This is not all settings, but only those that I encountered or seemed to me the most important for beginners. Options like preview_on_click, hot_exit may scare, but I would recommend trying them out.
Hotkeys

Hotkeys change according to the same principle as all other settings, and also take effect immediately after saving the config. In the case of any error, such as the wrong key combination, you can learn the details in the console (Ctrl + `). There you can find a lot of useful data. Pay attention to the picture on the right - this is a link to a detailed map of hot keys (accidentally found
on the network ).
I think it makes no sense to go deep into the settings of the keys. they are intuitive. For example, the following "bandage":
{ "keys": ["ctrl+e"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"} }
Delete Line Control + E. :
{
"keys": ["ctrl+shift+o"],
"command": "fuzzy_file_nav",
"args":
{
"start": "/www",
"regex_exclude": [".*\\.(DS_Store|svn|git)$"]
}
}
fuzzy_file_nav (. ), .
.. — .mousemap. , - .
IDE, . «default», «Project -> Save project as». - . ( , ). «Project -> Add folder to project», ( , ). fuzzy (Ctrl + P).
(Project -> Edit project). . ,
folder_exclude_patterns: [ "path_1", "path_2", ...]
file_exclude_patterns: [ "*.md",… ]. , , . fuzzy- , . - . — xdebug.
.
, NetBeans. — Ctrl + Alt + P. , , . ( , Ctrl + Shift + N) .
. - User. — Preferences -> Browse packages. . :) ( ) — PackageControl. .
— python. , . , ,
.
PackageControl
.
. install . python- (Ctrl + `) enter. — ? , . ( , PackageControl ). , .

«» PackageControl Preferences -> Package Control. ctrl + shift +p, . , «Install Package» — «ins» fuzzy . ? :) , , , . , .. , Preferences -> Packages settings -> %plugin_name%.
Aligment — //- , . , . , «Ctrl + Alt + A» ( Linux-).
FileDiffs — . «FileDiffs Menu» «Diffs with tab» , . , , . — , statusbar-.
FuzzyFileNav — , , , . Ctrl + P, , , , .
FileHistory — fuzzy / . , GotoOpenFile.
GotoOpenFile — Ctrl + P, .
JsMinifier — ( ) javascript. Google Closure Compiler UglifyJS. — statusbar, javascript- .
PhpDoc — PhpDoc. : /**[tab]. — []var[tab], []return[tab] .. , * :)
GotoTab — Ctrl + []. .
SublimeLinter — ( ). — CoffeeScript, CSS, Java, JavaScript, Objective-J, Perl, PHP, Python, Ruby. . , JavaScript- JsLint, jsHint gjslint. jsHint, , , true-coding-style, . , .. , , :) , SublimeLinter — . — , .
Tag — , XML. XML . , . , «div» ctrl + shift + "," <div></div> .
XDebug — xdebug. . NetBeans . — . *buntu «Troubleshooting» .
LastEdit — ctrl + q Netbeans. . , , , . , ,
.
. , — .
. nginx apache2 , SCSS Jade . , TextMate, .
Snippets
Snippet- — , . .. , <xsl:when test="some">some code</xsl:when> snippet. :
<snippet>
<content><![CDATA[for( var ${1:name} in ${2:source} ) if( ${2:source}.hasOwnProperty( ${1:name} ) )
{
var ${3:iterator} = ${2:source}[ ${1:name} ];
${0:// code}
}]]></content>
<tabTrigger>forin</tabTrigger>
<scope>source.js</scope>
<description>for( var name in source</description>
</snippet>
tabTrigger — , tab ( , .. Snippet- autocomplete). $1 «name», tab source, 3 . snippet- $0. —
Esc. Netbeans, Snippet- «» , ( «», :) ).
Scope — , snippet ,
description autocomplete.
. ,
.
— . Tools -> Record macro, — . (Tools -> Save macro) Packages/User . , json- . : { "keys": ["alt+1"], "command": "run_macro_file", "args": {"file": "Packages/User/%your_macros%.sublime-macro" } }.
Layouts
, ST2 , , screenshot
lor-. (2, 3, ..). , - , . 19" «» . , . , ( ), , .

Sublime Text 2 — . , , json- GUI.
ST2 — , IDE, , , . ,
autocomplete.
NetBeans, , IDE , , ( , nodeJS PHP-xDebug). ST2 «» , , , IDE, ctrl + left_click, . ST2 .
, ,
. — , . , . , .