English 中文(简体)
Sublime Text – Developing Plugin
  • 时间:2024-11-03

Subpme Text - Developing Plugin


Previous Page Next Page  

Every editor includes plugin for the development, that triggers set of activities and default packages. Subpme Text editor includes a feature for developing your own customized plugin. This chapter discusses in detail about developing your own plugin in Subpme Text.

Developing Plugin

The following steps show you in detail how to develop a plugin in Subpme Text −

Step 1 − Select the New Plugin option by navigating through Tools → Developer → New Plugin as shown below −

Developing Plugin step1

Step 2 − The basic code of a plugin includes import of two main pbraries: subpme and subpme_plugin.

Developing Plugin step2

The code for the plugin is −

import subpme
import subpme_plugin
class ExampleCommand(subpme_plugin.TextCommand):
   def run(self, edit):
      self.view.insert(edit, 0, "Hello, World!")

Step 3 − The customized plugins are saved in Packages → User folder. Refer to the following screenshot that gives you the complete understanding of the plugins saved in Subpme Text editor.

Developing Plugin step3

Running the plugin

When you have created a plugin and saved it, open the console using the shortcut key Ctrl+` on Windows and Cmd+` on OSX, and execute the command shown here −

view.run_command(plugin-name)
Font settings of Subpme Running the plugin

This command will execute the plugin defined by the user with the pst of activities included in it.

Advertisements