码迷,mamicode.com
首页 > 移动开发 > 详细

sublimtext快速插入appframework的html分页

时间:2014-11-26 11:27:57      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:app-framework   jqmobi   sublimetext   

  作者:木尘 日期: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=\"#\" style=\"left:0.7em\">返回</a>""\n"
				"      </header>""\n"
				"      <!--header  end-->""\n"
				"      <!--content部分-->""\n"
				"      <div class=\"content\" >""\n"
				"      </div>""\n"
				"      <!--content end-->""\n"
				"      <!--footer底部  -->""\n"
				"      <footer id=\"#\">""\n"
				"      </footer>""\n"
				"      <!--footer end  -->""\n"
				"   </body>""\n"
				"   <script  type=\"text/javascript\">""\n"
				"   //进入这个页面时调用""\n"
				"   function myPageLoadedPanel() {""\n"
				"      //dosomething""\n"
				"   }""\n"
				"   //离开这个页面时调用""\n"
				"   function myPageUnloadedPanel(){""\n"
				"      //dosomething""\n"
				"   }""\n"
				"   </script>""\n"
				"</html>"
            }
        )


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

2. 创建快捷键:

Preference → Key Bindings - User:

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

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

bubuko.com,布布扣

sublimtext快速插入appframework的html分页

标签:app-framework   jqmobi   sublimetext   

原文地址:http://blog.csdn.net/vincentblog/article/details/41510881

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!