在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,輸入如下設(shè)置
[
{
"command": "add_current_time",
"keys": [
"ctrl+shift+."
]
}
]
保存即可,這樣以后想要插入當(dāng)前時間時,就按’ctrl+shift+.‘即可