Answer the question
In order to leave comments, you need to log in
How to write a macro in Sublime Text 3?
Good day. I want to write a macro that, using hot keys, will add certain characters to the selected text. For example, the text "67px", I select it, press the hot key combination, and it will be converted to "(67px / 2)". Those. this text is separated by brackets, and inside - the value is divided by 2. How to implement this?
Answer the question
In order to leave comments, you need to log in
create a snippet
<snippet>
<content><![CDATA[(${0:$TM_SELECTED_TEXT}/2)]]></content>
<tabTrigger>dd</tabTrigger>
<scope>source.js</scope> //тут указываешь виды файлов где будет работать сниппет. можно через запятую
<description>dd</description>
</snippet>
{
"keys": ["ctrl+shift+1"],
"command": "insert_snippet",
"args": {"name": "Packages/User/dd.sublime-snippet"}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question