Home > Development Tools > sublime > body text

How to set macros in sublime text 3?

藏色散人
Release: 2019-08-22 14:29:36
forward
4619 people have browsed it

Macro is a rule or pattern, or grammar replacement. So how to set macros in sublime? Below, the sublime usage tutorial column will explain how to set macros in sublimetext3. I hope it will be helpful to friends in need!

How to set macros in sublime text 3?

sublime text 3How to set macros?

Definition of macro

Generally speaking, a macro is a rule or pattern, or syntax replacement, used to describe a specific input ( How to convert (usually a string) into the corresponding output (usually a string) according to predefined rules. This replacement is performed during precompilation and is called macro expansion

The role of macro

So much nonsense above, in fact, it is to use "one key" instead of "multiple keys", which is the same as encapsulation

How to implement macros in Sublime_text_3

Example: After pressing =, realize the equal sign with spaces on both sides

1. Start recording

Click Tools->Record Macro to start recording the macro. (You can also use the shortcut key ctrl Q )

2. Record

Find a file and write "space=space" //In fact, it is the rule or pattern to be implemented

3.End recording

Tools->Stop Recoding Macro (actually the button to start recording, so you can also use ctrl Q)

4. Save Macro

Operation: Tools->Save Macro

Personal habits are saved in your sublime/Data/User/Macoro (create if not)/your_filename.sublime-macro

Here we assume that we save your sublime/Data/User/Macoro/equal .sublime-macro

5. Add shortcut keys to the recorded macro

Preferences->Key bindings
Copy after login

Type the following content

  {
    "keys":["="],"command":"run_macro_file","args":{"file":"Packages/user/Macoro/equal.sublime-macro"}
  }
Copy after login

The above is the detailed content of How to set macros in sublime text 3?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!