import datetime, getpass from datetime
import timedelta import sublime, sublime_plugin
class TommorowCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.run_command("insert_snippet", { "contents": "%s" % datetime.date.today() + datetime.timedelta(days=1) } )
class YesterdayCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.run_command("insert_snippet", { "contents": "%s" % datetime.date.today() - datetime.timedelta(days=1) } )
我已将上面的代码保存为time.py
并将命令映射到热键以在编辑器中插入昨天和明天的日期。
我在这里做错了什么?