• sublime插件时间


    1. import datetime  
    2. import sublime_plugin  
    3. class AddCurrentTimeCommand(sublime_plugin.TextCommand):  
    4.     def run(self, edit):  
    5.         self.view.run_command("insert_snippet",   
    6.             {  
    7.                "contents": "--[[--"" "  
    8.                 " * @Description: ${1:Description}"" "  
    9.                 " * @Author:      JuhnXu"" "  
    10.                 " * @DateTime:    "  "%s"  %datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") +" "  
    11.                 " ]]"                  
    12.             }  
    13.         )  
    14. class AddFuncCommand(sublime_plugin.TextCommand):  
    15.     def run(self, edit):  
    16.         self.view.run_command("insert_snippet",   
    17.             {  
    18.                "contents": "--[[--"" "  
    19.                 " * @Description: ${1:desc}  "" "  
    20.                 " * @param:       ${2:string} ${3:name} "" "  
    21.                 " * @return:      ${4:nil}" " "  
    22.                 " ]]"                  
    23.             }  
    24.         )  

    按键映射

    [plain] view plain copy
     
    1. [  
    2.     {  
    3.         "command": "add_current_time",  
    4.         "keys": [  
    5.             "alt+shift+j"  
    6.         ]  
    7.     },  
    8.     {  
    9.         "command": "add_func",  
    10.         "keys": [  
    11.             "alt+shift+k"  
    12.         ]  
    13.     }  
    14.   
    15.   
    16. ]  

    import datetime
    import sublime_plugin
    class AddCurrentTimeCommand(sublime_plugin.TextCommand):
    def run(self, edit):
    self.view.run_command("insert_snippet",
    {
    "contents": "/**"" "
    " * @Description: "" "
    " * @Author: "" "
    " * @DateTime: ""%s" %datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") +" "
    " */"
    }
    )
    class AddFuncCommand(sublime_plugin.TextCommand):
    def run(self, edit):
    self.view.run_command("insert_snippet",
    {
    "contents": "/**"" "
    " * @Description: "" "
    " * @table: "" "
    " * @param: "" "
    " * @param: "" "
    " * @return: "" "
    " * @DateTime: ""%s" %datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") +" "
    " */"
    }
    )

  • 相关阅读:
    C#中 Thread,Task,Async/Await,IAsyncResult 的那些事儿!
    Java8的新特性以及与C#的比较
    点旋转坐标变换
    vc++返回模块路径
    为什么不要 "lock(this)" ? lock object 并是readonly(转载)
    《黄帝内经》要义
    C++多线程编程简单实例
    c++ 获取文件大小
    c# 获取文件夹大小
    自动驾驶仿真工具的下载与安装
  • 原文地址:https://www.cnblogs.com/brady-wang/p/5408032.html
Copyright © 2020-2023  润新知