您现在的位置是:首页 > 其他

李清波 2017-06-14 其他 3271 复制当前网址

Sublime Text 3 添加插入当前时间插件

1.制作插件

插件放置地址,工程路径:Sublime Text 3x64\Data\Packages\User\addCurrentTime.py

addCurrentTime.py 

import datetime
import sublime_plugin
class AddCurrentTimeCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.run_command("insert_snippet",
            {
                "contents": "%s" % datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
            }
        )


2.设置调用

开发工具路径:Preference → Key Bindings - User 

[
    {"keys": ["shift+alt+d"], "command": "add_current_time"}
]

3.使用快捷 :shift+alt+d


文章来源:http://liqingbo.com/blog-1390.html

评论