I haven’t looked at this in detail but, FWIW: A snippet cannot call a command, and I don’t believe there is a tm-variable that retrieves the current date.
I believe the date could be set as an environment variable, and then referred to in a snippet, but you might still need to set the variable (once a day) manually.
You could use the key-map Ctrl-F5 at the appropriate point within your snippet. Alternatively, you could copy and modify the date code so that you have a version that inserts your additional snippet-text as well:
[code]import sublime, sublime_plugin
from datetime import datetime
class DateCommand(sublime_plugin.TextCommand):
“”“Prints Date + H:M”""
def run(self, edit):
self.view.insert(
edit,
self.view.sel()[0].begin(),
datetime.now().strftime("%d/%m/%Y %H:%M")
)
class HourCommand(sublime_plugin.TextCommand):
“”“Prints only H:M”""
def run(self, edit):
self.view.insert(
edit,
self.view.sel()[0].begin(),
datetime.now().strftime("%H:%M")
)[/code]
class DateCommand(sublime_plugin.TextCommand):
"""Prints Date + H:M"""
def run(self, edit):
self.view.insert(
edit,
self.view.sel()[0].begin(),
'Hi,' + datetime.now().strftime("%d/%m/%Y %H:%M") + '\n\tthere!'
)