Date stamp
This following plug-in code is to insert a date stamp in Sublime Text using a shortcut ctr+shift+d:
-
From Tools → Developer → New Plugin… within Sublime Text, replace the template with the following python script:
import sublime import sublime_plugin from datetime import datetime class InsertFormattedDateCommand(sublime_plugin.TextCommand): def run(self, edit): formatted_date = datetime.now().strftime("%Y-%m-%d %H:%M") self.view.run_command("insert", {"characters": formatted_date}) -
Under Sublime Text Package / User folder, save the above script as
insert_formatted_date.py. -
Add a keyboard shortcut to get the date under Preferences → Key bindings:
[ { "keys": ["ctrl+shift+d"], "command": "insert_formatted_date" } ] -
Save the key bindings file, close Sublime Text, and reopen.
-
Now using
ctr+shift+d, insert formatted date.