$nbsp;
 
 

Buddy Toups: A Designer’s Blog January 30, 2008

How Tos: Auto Save Copy for TextMate

Filed under: Apple Related, Web Development — Buddy Toups @ 1:55 pm

You might be migrating to TextMate from BBEdit or some other text editors. And used a featured that allowed automatic backup copies for ever file you edit and save and was looking for this feature in Textmate, honestly it doesn’t exist. I found a solution in TextMate’s Wiki that works, quiet well actually, you create a small command in the Bundle Editor:

From TextMate Wiki Main / Howtos - TextMate Wiki

The Setup: Set up a TM_BACKUP_DIR environment variable in the Advanced / Shell Variables section of the TM preferences. Set it to the directory where you’d like your backups to be saved. Use the full path (i.e., /Users/michael/Documents rather than ~/Documents).

Save: Current File

Command(s):

# Save a copy of this file to the backup directory THEDATE=`php -r ‘print date(’Ymd‘);’` THETIME=`php -r ‘print date(’His‘);’` mkdir -p "$TM_BACKUP_DIR/$THEDATE" perl -e ‘while (<STDIN>) { print $_; }’ > "$TM_BACKUP_DIR/$THEDATE/$TM_FILENAME.$THEDATE.$THETIME.backup"

Std In: Entire Document

Std Out: Discard

Activation: Key Equivalent Cmd-S

My variation of the script Michael Lehmkuhl posted in the Wiki. I change the directory creation to duplicate the full file path of the current file in the backups folder.

# Save a copy of this file to the backup directory THEDATE=`php -r ‘print date(’Ymd‘);’` THETIME=`php -r ‘print date(’His‘);’` mkdir -p "$TM_BACKUP_DIR/<b>$TM_DIRECTORY</b>" perl -e ‘while (<STDIN>) { print $_; }’ > "$TM_BACKUP_DIR/<b>$TM_DIRECTORY</b>/$THEDATE.$THETIME_$TM_FILENAME"
Bookmark this page: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • Digg
  • Facebook
  • Technorati
  • Google
  • Live
  • YahooMyWeb
  • Slashdot
  • TwitThis
  • NewsVine
  • SphereIt
  • Simpy
  • Reddit

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment