Last active
May 4, 2019 11:34
-
-
Save sizhky/8440229e1e5851a00a03edd07b2c83be to your computer and use it in GitHub Desktop.
Insert date & time in sublime using a key-stroke
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 sublime, sublime_plugin, time | |
class InsertDatetimeCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
sel = self.view.sel(); | |
for s in sel: | |
# o = time.ctime().split() | |
# o = ' '.join(o[1:3] + ['(' + o[0] + ')']) | |
# self.view.replace(edit, s, o) | |
self.view.replace(edit, s, o) | |
# { "keys": ["ctrl+d", "ctrl+d"], "command": "insert_datetime"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment