在st中,Tools->New Plugin,输入如下python代码,保存为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")
}
)
再打开Preference->Key Binding-User,输入如下设置
[
{
"command": "add_current_time",
"keys": [
"ctrl+shift+."
]
}
]
保存即可,这样以后想要插入当前时间时,就按’ctrl+shift+.‘即可