Skip to content

Instantly share code, notes, and snippets.

@swarn
Created October 13, 2018 16:27
Show Gist options
  • Select an option

  • Save swarn/ca37b9eb42eed0314f5276634147eb05 to your computer and use it in GitHub Desktop.

Select an option

Save swarn/ca37b9eb42eed0314f5276634147eb05 to your computer and use it in GitHub Desktop.

Revisions

  1. swarn created this gist Oct 13, 2018.
    12 changes: 12 additions & 0 deletions isoD.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    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 []