A Simple Sublime Addon Example
`addCurrentTime.py` is A Simple Sublime Addon Example.
You can add your comment quickly.
please put the file in `\Data\Packages\User\addCurrentTime.py`
1
2
3
4
5
6
7
8
9
10
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")
"contents": "%s" % datetime.datetime.now().strftime("%Y.%m.%d") + " exia.huang"
}
)
You can add your hotkey, use alt+i
and you can insert time and message
1
2
3
[
{ "keys": ["alt+i"], "command": "add_current_time" }
]