sublime text增加插入当前时间快捷键
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")
}
)
3、设置快捷键映射 Preference → Key Bindings - User
{ "keys": ["ctrl+t"], "command": "add_current_time"}
4、重启sublime text即可