Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to insert the current date and time pressing a single key shortcut in TextMate. Any ideas how?

share|improve this question
up vote 7 down vote accepted

For date type isoD and then hit tab to insert an ISO date. This is documented here. This is a "snippet" that is part of the "Text" bundle.

To see how this snippet works, hit Ctrl-Opt-Cmd S, expand Text, and select Current Date. You'll see that it is simply shelling out to the Unix date command. You can control the output format by modifying the existing format string or by creating your own snippet with a custom format string.

See the date(1) man page for usage info and strftime(3) for details on the format string.

E.g., for both date AND time, you could use

`date "+%D %T"`
share|improve this answer

You can use Text -> Execute Line and Replace with Result then select the /bin/date utility (enter date in the box). Then Ctrl + Option + r should replace the current line with the date. If you'd like it formatted a specific way with the time, you can use a shell script that utilizes /bin/date and bind your shortcut to that.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .