Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 6 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.