Forked from uberbuilder/Default (OSX).sublime-keymap
Last active
April 24, 2017 07:53
-
-
Save adrianorsouza/10549782 to your computer and use it in GitHub Desktop.
Create a Date Time Stamp in Sublime Text 2 on a Mac
This file contains 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, getpass | |
import sublime, sublime_plugin | |
class AddDateTimeStampCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
self.view.run_command("insert_snippet", { "contents": "%s" % datetime.datetime.now().strftime("%Y-%m-%d %H:%M") } ) #:%S") } ) | |
class AddDateStampCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
self.view.run_command("insert_snippet", { "contents": "%s" % datetime.datetime.now().strftime("%Y-%m-%d") } ) | |
class AddTimeStampCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
self.view.run_command("insert_snippet", { "contents": "%s" % datetime.datetime.now().strftime("%H:%M:%S") } ) |
This file contains 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
Show hidden characters
[ | |
{"keys": ["alt+s"], "command": "add_date_time_stamp" }, | |
{"keys": ["alt+d"], "command": "add_date_stamp" }, | |
{"keys": ["alt+t"], "command": "add_time_stamp" } | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment