首页 > 代码库 > sublimtext快速插入appframework的html分页

sublimtext快速插入appframework的html分页

  作者:木尘 日期:2014-11-26

sublimtext快速插入html分页:

1. 创建插件:

Tools → New Plugin:

import sublime_plugin
class AddAfHtmlCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.run_command("insert_snippet",
            {
                "contents":
                "<!DOCTYPE html>""\n"
                "<html>""\n"
				"   <head>""\n"
				"	   <title></title>""\n"
				"   </head>""\n"
				"   <body>""\n"
				"      <!--header头部-->""\n"
				"      <header id=\"#\">""\n"
				"         <h1>我是header</h1>""\n"
				"         <a href=http://www.mamicode.com/"#/" style=/"left:0.7em/">返回""/n">

保存为Sublime Text 2\Packages\User\addAfHtml.py

2. 创建快捷键:

Preference → Key Bindings - User:

[
    {
        "command": "add_af_html",
        "keys": [
            "ctrl+shift+f5"
        ]
    }
]

3. 此时使用快捷键ctrl+shift+F5即可在当前光标处插入当前时间,如下:


sublimtext快速插入appframework的html分页