-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimestamp.py
More file actions
36 lines (34 loc) · 1.18 KB
/
timestamp.py
File metadata and controls
36 lines (34 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import sublime, sublime_plugin, time
import datetime
def InsertDatetimeCommand():
g = f'''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Globals</string>
<key>scope</key>
<string></string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>CURRENT_DATETIME</string>
<key>value</key>
<string><![CDATA[{time.strftime('%A, %d.%m.%Y %I:%M %p')} (GMT+5:30)]]></string>
</dict>
</array>
</dict>
</dict>
</plist>
'''
#<string><![CDATA[{time.strftime('%A, %d.%m.%Y %I:%M %p')} (GMT+5:30)]]></string>
f = open("/home/bob/.config/sublime-text/Packages/User/Default.tmPreferences","w")
f.write(g)
f.close()
class WindowFocusListener(sublime_plugin.EventListener):
def on_activated(self, view):
InsertDatetimeCommand()