Add timestamp hotkey plugin.

This commit is contained in:
Ethan Dalool 2020-03-05 17:24:23 -08:00
parent 5ef36ee793
commit 696ae47274
3 changed files with 13 additions and 0 deletions

1
.gitignore vendored
View file

@ -5,6 +5,7 @@ Meal/meal.db
*.key *.key
*.csr *.csr
*.crt *.crt
*.pyc
# Windows image file caches # Windows image file caches
Thumbs.db Thumbs.db

View file

@ -4,6 +4,7 @@
{ "keys": ["alt+shift+."], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" }}, { "keys": ["alt+shift+."], "command": "insert_snippet", "args": { "name": "Packages/XML/long-tag.sublime-snippet" }},
{ "keys": ["shift+delete"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"}}, { "keys": ["shift+delete"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete Line.sublime-macro"}},
{ "keys": ["ctrl+shift+enter"], "command": "insert", "args": {"characters": "\n#"}}, { "keys": ["ctrl+shift+enter"], "command": "insert", "args": {"characters": "\n#"}},
{ "keys": ["f4"], "command": "timestamp" },
// Auto-pair backticks // Auto-pair backticks
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context": { "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context":

View file

@ -0,0 +1,11 @@
'''
Thank you tpitale
https://gist.github.com/tpitale/11e5a2a152ec67a172f9
'''
import datetime
import sublime, sublime_plugin
class TimestampCommand(sublime_plugin.TextCommand):
def run(self, edit):
timestamp = "%s" % (datetime.datetime.now().strftime("%Y %m %d"))
self.view.insert(edit, self.view.sel()[0].begin(), timestamp)