Home  >  Article  >  Development Tools  >  How to set macros in sublime text 3?

How to set macros in sublime text 3?

藏色散人
藏色散人forward
2019-08-22 14:29:364645browse

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

Type the following content

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

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!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete