Skip to content

Instantly share code, notes, and snippets.

@zychen20
Forked from tpitale/README.md
Created November 2, 2022 19:59
Show Gist options
  • Select an option

  • Save zychen20/c8924c1fed4b8659f3bc47c468adb77a to your computer and use it in GitHub Desktop.

Select an option

Save zychen20/c8924c1fed4b8659f3bc47c468adb77a to your computer and use it in GitHub Desktop.

Revisions

  1. @tpitale tpitale revised this gist Aug 18, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion timestamp.py
    Original file line number Diff line number Diff line change
    @@ -3,5 +3,5 @@

    class TimestampCommand(sublime_plugin.TextCommand):
    def run(self, edit):
    timestamp = "[%s]\t" % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
    timestamp = "\n[%s]\t" % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
    self.view.insert(edit, self.view.sel()[0].begin(), timestamp)
  2. @tpitale tpitale revised this gist Aug 18, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion timestamp.py
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@
    class TimestampCommand(sublime_plugin.TextCommand):
    def run(self, edit):
    timestamp = "[%s]\t" % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
    self.view.insert(edit, 0, timestamp)
    self.view.insert(edit, self.view.sel()[0].begin(), timestamp)
  3. @tpitale tpitale created this gist Aug 18, 2014.
    5 changes: 5 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    1. Go to Tools > New Plugin
    2. Paste timestamp.py contents and save in User as timestamp.py
    3. Open Preferences > Key Bindings - User (or Default, your call)
    4. Paste keybindings.json, or add a line to your keybindings
    5. Customize the keyboard shortcut to your liking and save
    3 changes: 3 additions & 0 deletions keybindings.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    [
    { "keys": ["ctrl+shift+n"], "command": "timestamp" }
    ]
    7 changes: 7 additions & 0 deletions timestamp.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    import datetime
    import sublime, sublime_plugin

    class TimestampCommand(sublime_plugin.TextCommand):
    def run(self, edit):
    timestamp = "[%s]\t" % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M"))
    self.view.insert(edit, 0, timestamp)