sublime
for mac key :
Step-by-Step Plugin Creation
import sublime
import sublime_plugin
from datetime import datetime
class InsertCustomTextCommand(sublime_plugin.TextCommand):
def run(self, edit):
# Generate the current date information
now = datetime.now()
date_str = now.strftime("%B %d %Y")
day_name = now.strftime("%A")
day_num = (now - datetime(now.year, 1, 1)).days + 1
# Create the template text
template = f"""
-------------------------------------------------------------------------------------------------------------------
Day # {day_num} {date_str} - {day_name}
---------------------------------------
-------------/
"""
# Insert the text at the current cursor position
self.view.insert(edit, self.view.sel()[0].begin(), template)
Step-by-Step Plugin Creation
Key Binding
Plugin Code
How It Works
Last updated