Prevent TextEdit from opening for unknown file types that are plain text

filetext-editortextedit

TextEdit is used by the system so it can't be removed, but I have another text editor I use and it causes confusion when text files that don't have a suffix or don't have a suffix which I've already associated with my real text editor open in TextEdit.

An example of this getting really strange in a workflow is if I've selected many files that I want to edit and open them all up at once, and some are in my real editor and others have opened in TextEdit in the background, but I'm unaware of that. Another example is simply knowing that I opened a file some time back, but not being able to find it anywhere in my text editor because it is actually sitting there in TextEdit.

I don't mind that .rtf files or .doc files open with TextEdit but I would like to make it so that a plain text file of an unknown type or one which hasn't been actively associated with my real text editor will never open up in TextEdit. Is there any way to do that? I'm using 10.8.3.

Best Answer

I think this answer here is what you're looking for:

How does Mountain Lion set the default text editor for the "open -t" terminal command?

To change default text editor to e.g. textmate, execute this command in terminal then restart:

    defaults write com.apple.LaunchServices LSHandlers -array-add 
'{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.macromates.textmate;}'