(Reprinted must indicate the original address of this article http://write.blog.csdn.net/postedit/8962727and the author of Zhao Liang "and blog address http://blog.csdn.net/theforever)
Directory:
Hand-made http://blog.csdn.net/theforever/article/details/8962727
Plug-in development http://blog.csdn.net/theforever/article/details/8963194
Plugin release http://blog.csdn.net/theforever/article/details/8967507
Sublime text (hereinafter referred to as St) is an excellent tool for editing text and program code launched in recent years. As soon as you open it, you will realize that it is different from the previous editing tools, and feel that it is advanced in the interface arrangement, more beautiful and more considerate. If you have a brief understanding of its features through its Chinese and English introduction materials, you will find that this is based on the previous text and code editor, the editor collects some of the most urgent needs of many users and implements them to surprise you. Features are considerate and the interface is fashionable. This means that it can grasp your characteristics first, and then you will find that it has many useful plug-ins, including syntax supplements and prompts for various programming languages, zencode, formatting, and some common functional plug-ins. All these plug-ins are open code and can be viewed and learned, you can also modify it as needed. In addition, despite its powerful functions, the size of the St Installation File is less than 10 MB, and it runs smoothly on a low-end server. Therefore, this is definitely an editing tool worth your own.
You can search and read the articles on usage, hotkey introduction, and plug-in installation.
In Chinese, most articles only describe the use of ready-made Chinese packages. This is convenient, but it cannot solve all problems. Do not mention the time difference between version update and Chinese package update. Simply put, some of the plug-ins you have installed often require additional English menu items, which may lead to incomplete localization, it is not only the menus they add, but also top-level menus including ST are often re-overwritten and displayed in English. Because the Chinese package only includes the basic st function menu, it neither knows which plug-ins you will install, nor can it pre-define the menu items generated by those plug-ins, because it will generate a large number of useless menus that are not actually implemented.
Therefore, you can understand the plug-in package mechanism and learn to manually import plug-ins or even upgrade to the "St" language. This will allow you to take the initiative and solve the problem without waiting for others.
First, let's start with the Chinese ST:
1. There is a packages folder under the st installation folder. Enter this folder. You can see that all files in the folder are with the sublime-package extension, which indicates the st plug-in package. Many of these files use programming language names as file names. These are syntax files and are references for syntax highlighting and Automatic completion. But this folder is not the only one. It also includes the default theme solution and the more important default. sublime-package file. The menu file to be customized is included in it.
2. Next, you naturally need to know how to translate the menu file and make it take effect. The sublime-package extension is not a special physical file format, but a logical file classification representation. Its actual file format is actually zip (if you have enough software experience, will see similar usage in a lot of software), so as long as you change the extension to zip, you can use any zip-supported decompression software to decompress it into a folder containing all the files in the extension package.
3. Find several files with the extension sublime-menu in these files and open them in a text editor. All menu items are displayed. "Caption": "XXXX" indicates the name displayed in the menu. Except for {"caption": "-"} (indicating the menu group interval), replace the English behind the other caption with Chinese.
Note: "mnemonic": "A letter" indicates the keyboard access key of the menu. Therefore, you should enclose the letter in parentheses when translating it into Chinese, before or after Chinese.
4. Save and note that you must select utf8 (you can choose not to add the UTF header BOM) instead of GBK or gb2312. Because st wants to use utf8 to unify various global character sets and discard the automatic identification of GBK and other character sets, if it is saved as GBK, St cannot correctly recognize the Chinese character section, it cannot be displayed or is not displayed normally.
Speaking of this, by the way, st3 has a reopen menu, which contains 30 sub-menus. Apart from UTF16 and hex, many other sub-menus are European and American character sets, it can be found in the Code Page character set under the system registry HKLM \ SOFTWARE \ Classes \ mime \ database \ codePage, but there are some changes. If you are interested, try to see if you can add common character sets in Asia-hopefully st will not be racial.
5. Applications. To take effect, you need to decompress the folder and then compress it back to zip (Note: select all files in the folder to compress, instead of selecting folder compression outside the folder, in this way, it will not take effect because of the wrong directory level), then change back to the original extension, and move to the original folder.
We recommend that you use another local modification method, which is simpler and safer:
1. Same as above.
2. In the compressed package, extract only a few files with the extension sublime-menu and put them in a folder named default.
3. Edit and save the file. The precautions are the same as above.
4. Cut the default folder.
5. Select the "preferences/Preferences" Main Menu (second on the right)-> "Browse packages/browse extension package" in the St, and the system opens a folder, press Ctrl + V to paste the previously cut default folder here.
This method does not need to be repackaged and renamed, and can be changed at any time. The most important thing is to keep the original default. sublime-package file, in case the software can only be reinstalled if it cannot be recovered. At the same time, this method also immediately reflects the changes when saving the file. In the next tutorial "plug-in development", you can use this method to debug the plug-in.
The above is the Chinese version of the St subject. Modify the sublime-menu file in the default. sublime-package file of the extension package.
The method for translating other plug-ins is similar.
First, find the plug-in file. The st plug-in has three storage locations: the packages folder under the st installation folder and the packages folder found in step 3 above, there is also an installed packages folder that is the same as the second packages folder ("Browse packages/browsing extension package" can be viewed at the upper level ).
The plug-in name corresponds to the file name of the sublime-package file, so you can find the corresponding extension package. After finding it, use one of the above two methods to modify it.
The Chinese method has ended. In the second part of the tutorial, we will explain the steps of "Developing the st plug-in" and use an instance I have written for demonstration.