码迷,mamicode.com
首页 > 其他好文 > 详细

Sublime Text添加插入带当前时间说明

时间:2017-12-11 18:51:53      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:插入   too   使用   bin   blog   text   ext   http   pack   

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

插件实现插入带时间功能的说明:

1. 创建插件:

Tools → New Plugin:

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

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

2. 创建快捷键:

Preference → Key Bindings - User:

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

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

技术分享图片

技术分享图片

 

4. 参考:

http://blog.csdn.net/billfeller/article/details/41460345

 转载:http://blog.csdn.net/vincentblog/article/details/41483243

Sublime Text添加插入带当前时间说明

标签:插入   too   使用   bin   blog   text   ext   http   pack   

原文地址:http://www.cnblogs.com/chengqi521/p/8024118.html

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