Changelog / Header / TimeStamp Plugin for Sublime Text? -


i looking simple sublime text 2 plugin allow me to:

  • insert (hopefully automatically, not necessary) short template with

% created: timestamp

% modified: timestamp

and replace first timestamp once , second every time file saved.

the following plugin timestamp (modified this question):

import sublime_plugin datetime import datetime  class timestampcommand(sublime_plugin.textcommand):      def run(self, edit):         # formatting options @ http://docs.python.org/2/library/datetime.html#strftime-strptime-behavior         stamp = datetime.utcnow().strftime("%y-%m-%d %h:%m:%s utc")  # 2013-07-18 14:54:23 utc         # local time, change utcnow() now()         r in self.view.sel():             if r.empty():                 self.view.insert(edit, r.a, stamp)             else:                 self.view.replace(edit, r, stamp) 

save packages/user/time_stamp.py , bind ctrlaltt adding

{ "keys": ["ctrl+alt+t"], "command": "time_stamp" } 

to keymap (preferences->key bindings - user).

making plugin automatically update timestamp more complex, involving calling event listener. i'm still debugging it, check more...


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -