處理 Sublime Text 3 新增插入當前時間
阿新 • • 發佈:2019-02-16
1.製作外掛
1.1 外掛放置地址,工程路徑:Sublime Text 3x64\Data\Packages\User\addCurrentTime.py
1.2addCurrentTime.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.設定呼叫
2.1 開發工具路徑:Preference → Key Bindings - User
[
{
"command": "add_current_time",
"keys": [
"ctrl+shift+."
]
}
]
3.使用快捷 :ctrl+shift+.