Home Download Buy Blog Forum Support

InsertDate - About inserting the current date or time

InsertDate - About inserting the current date or time

Postby FichteFoll on Thu Jun 14, 2012 7:26 pm

I wrote this plugin a while ago which will insert the current (local) date or time into the view. It supports multiple selections, replacing selected text and has a variety of options like specifying the format string and binding that to a key combination.
Additionally I included the pytz lib to support named timezones. There are a bunch of examples how to use them.

I might look a bit complicated at first sight, but people using Sublime Text should get its usability soon enough.

Here is the default keymap as example:
Code: Select all
[
   // Insert datetime using default format text
   { "keys": ["f5"],                "command": "insert_date" },
   // Insert datetime using the specified format
   { "keys": ["ctrl+f5", "ctrl+d"], "command": "insert_date", "args": {"format": "%Y-%m-%d"} },
   { "keys": ["ctrl+f5", "ctrl+t"], "command": "insert_date", "args": {"format": "%X"} },
   { "keys": ["ctrl+f5", "ctrl+i"], "command": "insert_date", "args": {"format": "iso"} },
   { "keys": ["ctrl+f5", "ctrl+u"], "command": "insert_date", "args": {"format": "%x %X %Z", "tz_out": "UTC"} },
   // Prompt for user input, "format" would behave as default text
   // and insert the datetime using that format string
   { "keys": ["alt+f5"],            "command": "insert_date", "args": {"prompt": true} }
]



Link: https://github.com/FichteFoll/sublimetext-insertdate
FichteFoll
 
Posts: 211
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 5 guests