Skip to content

Instantly share code, notes, and snippets.

@sizhky
Last active May 4, 2019 11:34
Show Gist options
  • Save sizhky/8440229e1e5851a00a03edd07b2c83be to your computer and use it in GitHub Desktop.
Save sizhky/8440229e1e5851a00a03edd07b2c83be to your computer and use it in GitHub Desktop.
Insert date & time in sublime using a key-stroke
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