Created
July 1, 2012 12:46
-
-
Save simonwhitaker/3028343 to your computer and use it in GitHub Desktop.
Flip your TextMate file type associations to use Sublime Text 2 instead
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Quick and dirty script to flip all the file type currently | |
# associated with TextMate to be associated with Sublime Text 2 | |
# instead. | |
# | |
# DISCLAIMER: worked for me, might not work for you. Use at your | |
# own risk. I accept no responsibility if you trash your system. | |
# Specify the plist file we need to tweak | |
plist="$HOME/Library/Preferences/com.apple.LaunchServices.plist" | |
# Backup the current file | |
cp $plist $plist.$(date "+%Y%m%d") | |
# Convert the plist to JSON format | |
/usr/bin/plutil -convert json $plist | |
# Replace instances of "com.macromates.textmate" with "com.sublimetext.2" | |
/usr/bin/perl -pi -e 's/com\.macromates\.textmate/com.sublimetext.2/g' $plist | |
# Convert back to binary format | |
/usr/bin/plutil -convert binary1 $plist | |
# Reset the launch services DB to pick up the new settings. | |
# Not 100% sure you actually need to do this but doesn't seem | |
# to do any harm | |
/System/Library/Frameworks/CoreServices.framework/Frameworks/\ | |
LaunchServices.framework/Versions/Current/Support/lsregister -kill |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment