FIRST, install the package manager (tools install package manager) then in Preferences - Browse Packages - User (folder), make a file called whatever.py and paste the following 6 lines into it:
import sublime, sublime_plugin, time class InsertDatetimeCommand(sublime_plugin.TextCommand): def run(self, edit): sel = self.view.sel(); for s in sel: self.view.replace(edit, s, time.strftime( '%Y.%m.%d %H:%Y' ))
NOW in preferences - keybindings - User, add this line:
{ "keys": ["f5"], "command": "insert_datetime"}
Now in sublime text you can hit F5 to autoinsert the date and time just like notepad on Windows.
Comments
Post a Comment