Speeding up work with Emmet, or my first step to Open Source

Without claiming to be innovative or particularly deep in reasoning, I decided to write this article with two goals:

  1. Tell about my first experience in writing something useful for the IT community (specifically, a plugin for the Sublime Text editor). Perhaps this will lead to the creation of open-source projects for those who have never done this before, are embarrassed, afraid that there will not be enough qualifications or that it is necessary to write something global, etc.
  2. Show your co-developers the plug-in created as a result, which could very well save them precious minutes of life.

Let's start crossing ourselves.

1. Part one, with reasoning


Guys, this month I felt ashamed. Not as embarrassing as it is when something blurted out too much. And right globally. I suddenly realized that I was a useless element in the IT industry. I realized that all my life I used the gifts of open source, absolutely not offering anything to the community from myself. Shaped parasite.

And the main reason for this is my strange belief that my knowledge is not enough to write something useful for others.

To make you understand, I’m a typesetter, or, as it’s fashionable now, a front-end. But no, still a layout designer. I will not engage in self-deception at all. We can say that for several years I was stuck in this specialty, knowing about everything else (programming languages ​​and methods, various frameworks, databases, etc.) at the level of applied tasks and not very systematically. But, nevertheless, I can write simple programs and, anyway, do it all the time.

Well, returning to my problem - I felt ashamed. It is known that this feeling in everyone who does not suffer from mental illness causes first sadness and then a desire to change. When I got to the second stage, I discovered incredible discoveries for my narrow view of the world.

I can already hear your voices: “Share them with us, captain!”

But the captain is not sorry.

OPENING ONE: To simplify the work, my colleagues do not always need something revolutionary global, as I for some reason thought, sometimes a small tool is enough to help in a narrow sphere and quite “raised” by me. And the problems that can be solved with such tools are full.

OPENING TWO: to do something useful for people, to put it on public display - this is an unrealistically cool kick to oneself for professional development.

Yes, yes, I clearly understand that most of the people reading this text came to these thoughts at the beginning of their careers, and there is nothing new here. But if at least one of you looks like me and so far only inclines to such conclusions, then the words are not wasted and I have the moral right to continue the story.

And now, in fact, about what was my first step in the world of professional altruism.

2. Part two, with ideas


And so I sat down for my first open source. What is useful for me to write first? Another jquery slider? Or some kind of “nothing like” bootstrap-like framework (to be honest, I can’t imagine why they are being produced in such numbers now). I did not want to suck the idea out of my finger.

And I thought about what I personally lack now. As you remember, I am typesetting, and how many layout designers (if not all) use the Sublime Text editor and the wonderful Emmet plugin in their work . It at times makes it easier to write html markup and css styles. But, for our needs, let us dwell on his work with styles.

Usually, my work with the plugin looks like the majority: when I want to write some css-property, I write its Emmet-reduction, press Tab, the expansion is expanded into a normal property, at the end I switch to a new line with Enter. This process, as they say, has already gone into the fingers and, it seems, everything in it suits everyone.

But each time press Tab -> Enterit suddenly seemed redundant to me. Why not write down the abbreviations in a row, with a space, which is much faster, and then disclose them all? It may seem that this is “savings on matches”, however, my experience shows that usually we write properties not one at a time, thinking after each, but by logical groups, for example, position is usually followed by left and top, the values ​​of which we already know and can write them in a row without pauses, or when we write width - we already know what height will be next. And there are many such examples. So there is a good reserve for reducing the amount of unnecessary movements.

Emmet itself has its own implementation of this behavior: if you write the value through the “+” sign and finally press Tab- they will all open at once. But constantly reaching for the plus, and even with shift, pushing it seemed to me uncomfortable, and I decided to organize the behavior I needed as a separate plugin. This went beyond my original competence; plugins for Sublime are written in Python, which I was familiar with quite superficially. But, as the ancients used to say, war is garbage, the main thing is maneuvers.

3. Part Three, with the results


This is what my work now looks like using the EmmetOneLine plugin I wrote:
image

As you can see, the Emmet logic has been saved, everything is revealed as it should, and there are no more tabs and new line breaks. Lepota.

By default, I hung up the disclosure of all blocks on Ctrl + Tab , in the future I think to fasten the string check for several properties and do a tab expansion when it is available. This will also be needed for those who use Ctrl + Tab to navigate tabs. (I usually use fuzzy document search for this).

The plugin was written by me in a few hours, at night, in a burst of inspiration. The Sublime API turned out to be quite friendly, there were a couple of articles on the Habré and several foreign materials on this topic, things went quickly, since the logic was outlined not particularly confused. To my, I must say, pleasant surprise, I had enough of a general idea of ​​Python, a little programming experience in other languages ​​and a few practices from other plugins to make the first working version suitable for use. For the purpose of publication, I got an account on GitHub, which I did not do before, using only BitBucket in work projects. The process of publishing the plugin in Package Control is so elementary at all,

Now my little plugin is online and ready to save you time. And I got interesting experience, energy to finalize the plugin and plans to increase the complexity of future open and not only projects.

4. A few words in the end


To summarize, I really want to wish those novice developers who have never written anything for the community - to do as I just start to do it. Open Source is not always something complicated, there is a need for small, simple solutions. Do not, like your humble servant, be ashamed of ignorance of some questions, level of English, practical skills for so many years and close this interesting world for yourself. Find the problem you are interested in and solve at the level at which you can. People will understand you and, if the project is useful, they will correct the code and help with advice.

For which, by the way, I would be very grateful to the respected more experienced colleagues! I will be glad of any help or criticism regarding the work or the description of the plugin (including regarding errors in the English description of the plugin's work).

For this, let me take my leave and wish everyone professional growth!

Link to the plugin.

Also popular now: