(Reprinted must indicate the original address and the author "bihai Qing Tian Zhao Liang" and blog address http://blog.csdn.net/theforever)
In the first part of this tutorial series talked about the "St Chinese method" (http://blog.csdn.net/theforever/article/details/8962727), the main significance is to be able to solve the st Chinese package for the plug-in to add the menu can not be Chinese, and some plug-ins may change the menu in Chinese to English again.
In the second part of the series, the "ST plug-in Development Method" (http://blog.csdn.net/theforever/article/details/8963194) is introduced ). You can develop and use your own plug-ins and distribute them in a small scope.
However, if you want your plug-ins to appear in the "Install plug-ins" list on the st package control panel, users who love st around the world will have the opportunity to taste the fruits of your work and feel a sense of accomplishment, you have to patiently read this part of content.
First, avoid using Chinese characters in your plug-ins. Because ST's attitude towards GBK has already explained everything, it is very impossible for you to pass the review mentioned below.
Then, to help you better understand why you want to perform the following actions, I will introduce how P C works. It is implemented using the functions of two popular source code project servers (GitHub and Bitbucket. It stores a plug-in list file on the source code server, which contains the plug-in list displayed when you select "Install plug-in. Therefore, you only need to submit your plug-in address to the plug-in list file. P c will automatically find your plug-in address based on the user's choice, package your plug-in into a zip file through the packaging function provided by the source code server, download and save it to the st plug-in directory on your computer, then change the extension to sublime-package. St automatically scans the directory of the plug-in and applies the new plug-in. If the plug-in URL you provide does not support the packaging function, it will be downloaded and stored in a directory with installed
The packages folder is in a hierarchical packages folder.
To add your plug-in address to the plug-in list file, you need to provide your plug-in according to the requirements of this list.
Take GitHub as an example (Bitbucket is roughly the same ).
Register an account at www.github.com. Because this is the source code repository server, rather than the compiled software, the review mechanism is very loose, and even the casually entered email can be successfully registered. However, you will be reminded later to verify at least one email address (you can set a private email address for logon and a public email address for communication ). Of course, because your source code has to face a large number of experts, do not worry about what to do.
After registration, you can find the "Create repository" button next to your account in the upper-right corner of the website, and click it to name your repository, that is, the name of your plug-in. In this step, you must note that this server is not limited to storing the source code of the St plug-in, so you will definitely want to name your repository "sublime XXXX. It is recommended that you do not add this parameter at this time, because p c thinks this is totally redundant for it, and all submitted to it must be the st plug-in, downloading a plug-in with such a name to a user's computer also bored users with such obvious redundant content. Therefore, p c requires that the plug-in name should not contain such words. For those unfortunate names, P
C also introduces the name ing function. This not only adds a ing setting procedure for you, but also makes your actual plug-in URL different from the plug-in name seen and used by users. Therefore, it is best not to add it when creating a repository, only the name that describes the role of your plug-in. In addition, you should use a camper name to avoid underline. Enter the description of the plug-in the description column of the repository, including the applicable version number and usage. Check the generate readme. md check box. OK.
Now you have an empty code repository. You can use git or GitHub for synchronization and version updates, you can also use the "new file" and "edit file" functions on the webpage to create and modify files. It is easier for new users to use the latter, and the former can improve efficiency.
Assume that you have saved your plug-in content to the repository in either of these two ways. Now you need to create a packages. JSON file in the root directory of the repository and write the following content to it:
{
"schema_version": "1.2",
"packages": [
{
"name": "Your plugin name, such as PasteWithoutBlankLines",
"description": "Description of your plugin",
"author": "Author name, you can write your real name or username on github",
"homepage": "https://github.com/your username / plugin name",
"last_modified": "Last modified datetime",
"platforms": {
"*": [
{
"version": "Your plugin version number",
"url": "https://nodeload.github.com/your username / plugin name / zip / tag name"
}
]
}
}
]
}
Make sure to set your information for each key name above. If the plug-in can work on all operating system platforms, the platforms key should be written as "*". If the plug-in is designed for a specific operating system, it should be written as "OSX ", "Windows" or "Linux", you can also specify different implementation methods and versions of plug-in URLs for the three or two platforms (although this is rarely used, because in a single version, you can use programs to determine different operating systems and perform different operations ). If you only use one operating system for a long time, you may think that it is common to ignore the other two. However, if the author of p c faces users who use different operating systems around the world, you will know that he will pay attention to this point.
The URL key must be specified on the https://nodeload.github.com, otherwise it cannot be properly downloaded on all machines.
The last part of the download URL is the tag branch name. Although the main branch can be used, it is recommended to tag a specific version of the code.
After upgrading the plug-in version, remember to change the version and URL in the packages. JSON file in the main branch.
Extract packages. JSON from the author of p c below, and it will be clearer:
{
"schema_version": "1.1",
"packages": [
{
"name": "Alignment",
"description": "Easy alignment of multiple selections and multi-line selections",
"author": "Will Bond (wbond)",
"homepage": "http://wbond.net/sublime_packages/alignment",
"last_modified": "2011-09-18 23:13:00",
"platforms": {
"*": [
{
"version": "2.0.0",
"url": "http://sublime.wbond.net/Alignment.sublime-package"
}
]
}
},
{
"name": "Package Control",
"description": "A full-featured package manager",
"author": "Will Bond (wbond)",
"homepage": "http://wbond.net/sublime_packages/package_control",
"last_modified": "2013-01-21 20:13:00",
"platforms": {
"*": [
{
"version": "1.6.3",
"url": "http://sublime.wbond.net/Package Control.sublime-package"
}
]
}
},
{
"name": "Prefixr",
"description": "Runs CSS through Prefixr.com API",
"author": "Will Bond (wbond)",
"homepage": "http://wbond.net/sublime_packages/prefixr",
"last_modified": "2011-11-14 12:40:00",
"platforms": {
"*": [
{
"version": "1.0.1",
"url": "http://sublime.wbond.net/Prefixr.sublime-package"
}
]
}
},
{
"name": "SFTP",
"description": "Commercial SFTP/FTP plugin - upload, sync, browse, remote edit, diff and vcs integration",
"author": "Will Bond (wbond)",
"homepage": "http://wbond.net/sublime_packages/sftp",
"last_modified": "2012-08-08 08:43:00",
"platforms": {
"linux": [
{
"version": "1.10.2",
"url": "http://sublime.wbond.net/SFTP.sublime-package"
}
],
"osx": [
{
"version": "1.10.2",
"url": "http://sublime.wbond.net/SFTP.sublime-package"
}
],
"windows": [
{
"version": "1.10.2",
"url": "http://sublime.wbond.net/win/SFTP.sublime-package"
}
]
}
},
{
"name": "SVN",
"description": "Full-featured commercial Subversion plugin with a focus on usability",
"author": "Will Bond (wbond)",
"homepage": "http://wbond.net/sublime_packages/svn",
"last_modified": "2012-08-13 02:07:00",
"platforms": {
"linux": [
{
"version": "1.5.2",
"url": "http://sublime.wbond.net/SVN.sublime-package"
}
],
"osx": [
{
"version": "1.5.2",
"url": "http://sublime.wbond.net/SVN.sublime-package"
}
],
"windows": [
{
"version": "1.5.2",
"url": "http://sublime.wbond.net/win/SVN.sublime-package"
}
]
}
},
{
"name": "Terminal",
"description": "Launch terminals from the current file or the root project folder",
"author": "Will Bond (wbond)",
"homepage": "http://wbond.net/sublime_packages/terminal",
"last_modified": "2011-11-28 22:49:00",
"platforms": {
"*": [
{
"version": "1.3.1",
"url": "http://sublime.wbond.net/Terminal.sublime-package"
}
]
}
},
{
"name": "Tortoise",
"description": "Keyboard shortcuts and menu entries to execute TortoiseSVN, TortoiseHg and TortoiseGit commands",
"author": "Will Bond (wbond)",
"homepage": "http://wbond.net/sublime_packages/tortoise",
"last_modified": "2011-11-05 23:08:00",
"platforms": {
"windows": [
{
"version": "1.2.1",
"url": "http://sublime.wbond.net/Tortoise.sublime-package"
}
]
}
}
]
}
We can see examples of providing different plug-ins for different operating systems. We can also see that the packaged extension files can be specified directly. It is concise to place a packages. JSON and a package plug-in your repository, but you cannot directly modify your code file on the source code repository server.
Finally, open
A repository copy of package_control_channel. Find the copy in your account, go to, edit repositories. JSON, insert a row in the appropriate location, the content is:
"Https://raw.github.com/your account number /your plug-in warehouse /master/packages.json ",
Pay attention to the following points during editing:
1. Do not change the original content, including the line terminator and indentation. Add only your own rows. Because the examiner will compare your changes on the version server. If you find that each line of the article has changed, you will certainly have no patience to check what you have added and whether it has damaged others' content, the result will naturally reject merging your changes. (I seem to have accidentally changed the indent settings ...... Haha, ruined. If it weren't for this kind of habit, I wouldn't write such a plug-in. I think it's very common, but I never saw anyone writing it. Am I so small)
2. When adding an object, insert the object to a proper position in alphabetical order like the original content. This will make the entire list clear, not messy.
3. Unless you need to perform name ing, you do not need to take care of the subsequent sections.
Save the settings. After the project is successful, there is a "pull request" (request push) on the top of the project, that is, to submit the changes you just made to the original package_control_channel project, waiting for the approval of the author, so the rest is waiting. After the approval is successful, the plug-in URL you added will be displayed for download and installation when the global st user installs the plug-in, and will also appear in the http://wbond.net/sublime_packages/community
On the page, the page displays all the information about the plug-ins submitted to p c in sequence (that is, you are in packages. JSON.
If you have not created or entered packages. JSON, p c uses the last update date and time of your code repository as the version number. This will cause a waste of performance. Because every time p c starts, it will check the version numbers of all plug-ins. If you change one file, another file will be changed later. In this process, users around the world may have many users who have installed your plug-ins who are constantly upgrading the plug-ins at intervals. Before you finish all the modifications and officially decide to upgrade the plug-in version, this is definitely unnecessary waste. As mentioned above, we recommend that you create a branch as the download URL of the plug-in. In your main branch, you only need to store packages. JSON, in which you can use the URL to point out the real address and version of your plug-in. In this way, as long as the file content remains unchanged, your plug-in repository will not cause frequent updates no matter how it is modified.
Now, all the tutorials on development and submission of St ing and plug-ins are complete. This tutorial mainly focuses on introducing the general process and some important points of attention. It does not explain much about the plug-in development Language Python. First, it is due to limited space, second, it is another specialized category. For the APIS provided by St for plug-in development, refer to the API help documentation on the st official website. Due to the large amount of content, it is inconvenient to repeat it here.
PS: from last year's use of St to the present, I didn't think of writing a plug-in again until I gave a friend the menu of the Chinese ins and wanted to write a manual ing method. As I said, I have already written plug-ins for this function to the browser. However, you only need to sort the clipboard and paste it into the editor. I also wrote to UE and us for the editor before. However, due to some inconvenient problem, St is often used instead of UE/us, so it is worth writing to think about it. After writing it, I used it very well, but I was a little angry: What should I do for a long time.