Ideas for Sublime by CudaText

    Since 2012 I have been using editors created by Alexey Torgashin to view and modify almost all text files, logs and program codes in VFP / JS / Python / XML / HTML languages : first it was SynWrite , now its descendant CudaText . I deliberately chose his editor from the list of tested ones, which included, among others, AkelPad , Notepad ++ and Sublime Text . The responsiveness of technical support turned out to be decisive - Alexei received a huge number of wishes / complaints from users and quickly implemented them. I will explain. The number of requests / complaints was approximately uniform all the years, and after switching to GitHab three years agoIt has become measurable and is rated by me as 400 wishes / year and 100 bugs / year. It is pleasantly surprising that the expansion of the functionality at the request of the workers did not affect the reliability of the editor as a whole. And when the resource of sustainable development SynWrite was exhausted, CudaText appeared .


    I give the floor to Alexey.

    I have a conversation with Alexey on various topics. He recently listed what is missing in Sublime. It seemed to me interesting, and we agreed to present these ideas in Habré. Next will be a summary of theses from Alexei in my editing.


    After spending several years creating your own program, you’re looking at the results of your competitors in another way. You notice in them not only successful features (either you have already applied them, or you want to use them), but also disadvantages. I’ll show what could be improved in Sublime Text (hereafter Sublime ), if I compare it with my CudaText (hereafter Cuda ). At the same time, I emphasize that my editor appeared when Sublime was already widespread, many of his ideas were basic for Cuda :


    • Text config files
    • Overlapping settings
    • Multi-carriage
    • Python Plugins
    • Palette of all teams

    Sublime rigidly imposes a text-team work style.
    For example.


    • There are no dialogs to configure - there are only json files (there are a lot of them).
    • There are no additional controls in the Search by Files dialog - instead of them there is a “language” for filling in text fields.

    This style is efficient, flexible and expandable, but requires continuous training from the user. For beginners, this creates a noticeable threshold for entry.


    Cuda is trying to be a more accessible tool. This is possible because it is created in the Lazarus environment , which provides a rich GUI arsenal and portability between Win / Linux / Mac . As a result, the flexibility of json-settings in Cuda is combined with dialog-plugins, for example, Search by Files (there is a habr-review ), a settings editor, and others.
    I will try to make a few ideas on how Sublime can be improved . Of course, this is just my personal opinion.


    Toolbars


    The Sublime no toolbars. This is how his text-command style is manifested. Apparently, it is assumed that the useful place for the edited code is more important. You can call all commands either from the menu, or from the Palette by name, or via hotkeys. There is a clear drawback to this approach - you need to know in advance either the name of the team, or its hot key. But the existence of the necessary team and its name is not always obvious.
    Customizable, including disabled, toolbar - one of the details that reduces the threshold of use.


    At Cuda has a horizontal customizable toolbar to display the commands and the vertical sidebar to switch panels: Wood, Project Console. The API is responsible for setting up the toolbar, that is, it is executed via a plugin. New buttons may appear in the sidebar if the plugins add new panels.


    toolbar_sidebar


    Adding a toolbar to Sublime would not break any of its previous technologies.


    Status bar


    The sublime status bar is poor.


    sub_statusbar


    (1) Switch the console / Find / Replace / PoFaylam
    (2) Communication
    (3) Encoding
    (4) Type the EOL
    (5) Setting Tab
    (6) The syntax
    of these six fields are only two (Encoding and EOL) can be hidden through configuration, and in the Message field, plugins can add / remove key pairs = value. Neither hide, nor rearrange, nor adjust the remaining fields. It is especially strange that important information about the carriage (s) / allotment (s) falls inside the Message field, where it is mixed with texts from commands.


    In Cuda, the user can user.jsonspecify the sequence, width and alignment for the status bar fields:


    "ui_statusbar_panels": "caret,L,250|msg,L,0|lexer,L,70|tabsize,L,70"

    and filling the field caret(information about carriages / excretions) can be configured separately using macro substitutions. For example, so


    "ui_statusbar_no_sel": "r={y}/{count} c={xx}",
    "ui_statusbar_carets": "carets={carets} top/bot={y}/{y2}",
    "ui_statusbar_col_sel":"r={y}/{count} c={xx} s=[{sel} x {cols}]",

    As a result of these settings, Cuda will display in the status bar.


    • If one carriage: 1crt
    • If four carriages: 4crt
    • If vertical selection: vert

    Another Cuda allows you to configure how long you need to display text in the Message field.


    Code tree


    The desire of Sublime to represent everything in text form is understandable. However, the rejection of the Tree panel, which is available in all IDEs and advanced text editors, is very painful. You can apply a “text tree” placed in a normal tab (for example, with a plugin Outline), but it is poorly integrated with the Sublime interface , and is not a complete replacement.


    In Cuda there is a panel Code treefor displaying the syntax elements of the active file: functions / classes / fields for program languages, tags / keys for markup languages.


    tree


    Integration:


    • The display is synchronous, that is, the tree displays the status of the code immediately after its change (with a custom delay).
    • The selected tree node is synchronized with the position of the carriage in the code.
    • Tree nodes are used to select blocks, move carriage and other operations.

    In addition, the Cuda API allows you to create a new panel with a tree and fill it. The plugin Project Managerdoes just that.


    Folders with settings and plugins


    For a user who is not deeply immersed in Sublime manuals , the situation with the placement of settings / packages / plug-ins in folders looks confusing. The first step inside the newly-installed editor is dumbfounded: the menu command Preferences -- Settingsopens two files, one of which (default settings) in the title of the editor is seen as (in Win)
    Sublime Text 3/Packages/Default/Preferences.sublime-settings
    but there is no such file or folder on the disk. In general, the logic in this focus is guessed. The default settings must be sewn into the code of the editor, and whether they will be duplicated in any file or not is at the discretion of the developer. Sublime pretends they are in the file.


    In Cuda, the default settings are also protected, but there is a real file
    settings_default\default.json
    in the assembly in which they are duplicated and commented. The presence of such a file creates convenience not only for users, but also for plugins. For example, the settings editor retrieves from this file both the list of options, and comments to them, and markup for distributing options to the tree.


    With packages in Sublime similar problems happen - you look for them in Packagesand you don’t find them.


    Although Cuda does not have such a powerful base of additional packages, like Sublime , but the logic of placement in Cuda is transparent. For example, for plug-ins there is one folder pyin which everything is visible - both standard and pre-installed. For themes there is a folder data/themes, for snippets - data/snippetsfor lexers - data/lexlib.


    Package control


    Strange situation with the plugin Package Control. On the one hand, out of the box Sublime comes without this plugin. On the other hand, almost nothing serious can be done without him - the editor is not very good without supplements. Even placing the plug-in on the menu Preferences, rather than in Tools--Packagesindicates its special status. Apparently, some kind of “copyright” makes it difficult to include this plugin in the Sublime assembly .


    The Cuda several plugins (currently 10), including Addons Manager, included in the distribution.


    Floating panels


    At Sublime monolithic arrangement of windows, ie Console and Group tabs are grouped together. You can run several instances, but in each of them there will always be tabs and, perhaps, a console.


    The Cuda has settings and commands to display the console in a separate window. This allows you to comfortably stretch it without affecting the height of the main text and, for example, place it on a second monitor. In addition, you can separate the panel with the Tree, so as not to limit the width of the main text.
    flow_panels


    By the way, Atom (or VS Code ) users would like to have floating panels, but the developers refused, citing Electron restrictions . So this could be Sublime’s advantage over direct competitors.


    Tuning plugin


    At Sublime more than a kernel configuration (107 in version 3.1.1), and six additional overlapping levels to accommodate the changed values:
    (1) Packages/Default/Preferences (<platform>).sublime-settings
    (2) Packages/User/Preferences.sublime-settings
    (3) <Project Settings>
    (4) Packages/<syntax>/<syntax>.sublime-settings
    (5) Packages/User/<syntax>.sublime-settings
    (6) <Buffer Specific Settings>
    It is easy to imagine a situation where purely manual support even a small part of 700 values ​​(100 keys on 7 levels) becomes a problem.


    In Cuda, there are almost 300 kernel settings, and there are three additional levels for overlapping them:
    (1) settings/user.json
    (2) settings/lexer <syntax>.json
    (3) <File Settings>
    The problem is the same - too many values ​​(up to 300 * 4) must be taken into account. To help users there is a plugin that displays all settings at all levels in a table, which simplifies the search and editing.
    ops-dlg
    Pay attention to the column Section- the settings are assigned to the nodes of the tree. This gives additional sorting and filters. Markup for building this tree is included in the comments to the settings in the file settings_default\default.json. For example, a comment


    // [UI/Listbox]`

    assign the following options to the node UI/Listbox. The whole tree can also be seen
    ops-tree


    For Sublime, a similar dialog is quite possible:


    • The name and the seven levels of overlap are just eight columns in the table.
    • The form and controls can be taken from the Tk or more advanced Python GUI library.
    • Changing options can lead to changes in the files and reloading them when saving.

    Little things


    There are a few minor complaints that, of course, the right place is not here, but in the Sublime technical support forum . Let it be for completeness.


    1. Do not work PgDn/ PgUpin dialogs-lists, for example, in the Command Palette.
    2. Often you need to insert some tricky character, such as an arrow or a fraction. There is not enough tool to view / select all unicode characters. In Cuda, such a tool is in the form of a dialogueChar map
      char-map
    3. There is no possibility to set individual label coloring. When a lot of files are open, often there is a desire to color the labels of some of them. In Cuda, the command Set tab color...is in the local menu above the shortcut. The colors thus configured are saved in the session.

    Conclusion


    How easy to hand out tips!


    But the above considerations, in my opinion, are not without good. If the next version of Sublime Text comes in handy, it will be fine. By the way, maybe someone will translate and transfer ideas to Skinner (Jon Skinner).


    Also popular now: