Prevent TextEdit from opening for unknown file types that are plain text
I think this answer here is what you're looking for:

How does Mountain Lion set the default text editor for the &quot;open -t&quot; 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;}'