- Go to Tools > Developer > New Plugin
- Paste timestamp.py contents and save in User as timestamp.py
- Open Preferences > Key Bindings - User (or Default, your call)
- Paste keybindings.json, or add a line to your keybindings
- Customize the keyboard shortcut to your liking and save
-
-
Save msj2/d74a1044c8b284280b30a47055677b25 to your computer and use it in GitHub Desktop.
Sublime Text plugin to create a simple timestamp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ "keys": ["f5"], "command": "timestamp" } | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import sublime, sublime_plugin | |
class TimestampCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
timestamp = "\n[%s]\t" % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M")) | |
self.view.insert(edit, self.view.sel()[0].begin(), timestamp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment