1.参考地址
https://docs.sublimetext.info/en/latest/extensibility/plugins.html
2.进入开发者模式
菜单栏: Tools → Developer → new plugin
3.插件编写
4.保存
Ctrl + S,进行插件保存,命名文件,【.py结尾】,看具体实现语言
目录为:…/Sublime Text 3\Packages\User
5.命令操作
Ctrl + ~打开控制台;
输入命令:view.run_command(‘xxx’) //回车执行
6.Command命令说明
Sublime text插件命令的命名规则:
插件命令的解析规则很简单, 命令名称 + Command
构成class, 当然这里的命令名称是首字母大写的,但是执行的时候会转化为小写的,例如:
class MikeWangCommand
所对应的命令是: mike_wang,也就是说如果是多个首字母大写加上Command,就是多个单词小写加上_
官文说明:
Conventions for Command Names
You may have noticed that our command is named ExampleCommand
, but we passed the string example
to the API call instead.
This is necessary because Sublime Text standardizes command names by stripping the Command
suffix and separating PhrasesLikeThis
with underscores, like so:phrases_like_this
.
New commands should follow the same naming pattern.