sublime快捷键插入当前时间

1、创建时间插件  Tools -> developer -> New Plugin...

2、插入如下代码,保存在 Packages\User\addCurrentTime.py  

 

import sublime
import sublime_plugin
import datetime

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") + ' By JackLiu ' } )

3、设置快捷键映射  Preference → Key Bindings - User

{ "keys": ["ctrl+z"], "command": "add_current_time"}

4、重启sublime3即可

 

转载于:https://www.cnblogs.com/zhendong/p/8440831.html

你可能感兴趣的:(sublime快捷键插入当前时间)