# How does Mountain Lion set the default text editor for the “open -t” terminal command

command linetext-editortextedit

OSX seem to offer open -t command line shortcut to open arbitrary files in the system default text editor.

• Where is this default text editor set?

• Can I change it from the command line (if possible) or otherwise programmatically?

The default choice of TextEdit is limiting.

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