Skip to content

Instantly share code, notes, and snippets.

@swarn
Created October 13, 2018 16:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save swarn/ca37b9eb42eed0314f5276634147eb05 to your computer and use it in GitHub Desktop.
Save swarn/ca37b9eb42eed0314f5276634147eb05 to your computer and use it in GitHub Desktop.
Textmate-style isoD snippet for SublimeText
import sublime, sublime_plugin
from datetime import datetime
class TimestampCommand(sublime_plugin.EventListener):
"""Expand `isoD` to YYYY-MM-DD."""
def on_query_completions(self, view, prefix, locations):
if prefix == 'isoD':
val = datetime.now().strftime('%Y-%m-%d')
else:
val = None
return [(prefix, prefix, val)] if val else []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment