Useful macOS defaults: TextEdit

com.apple.TextEdit controls how TextEdit handles documents. By default, TextEdit opens in rich text mode with formatting. Many people prefer plain text.

After changing these, quit and reopen TextEdit.

Open new documents in plain text

defaults write com.apple.TextEdit RichText -int 0

To go back to rich text:

defaults write com.apple.TextEdit RichText -int 1

Use UTF-8 for plain text files

Set the encoding for opening plain text files:

defaults write com.apple.TextEdit PlainTextEncoding -int 4

Set the encoding for saving plain text files:

defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4

The value 4 is UTF-8. This stops TextEdit from using older encodings that can mangle special characters.

Show the ruler

Turn on the formatting ruler by default:

defaults write com.apple.TextEdit ShowRuler -bool true

Set the default font

Set the default plain text font:

defaults write com.apple.TextEdit NSFixedPitchFont -string "Menlo-Regular"
defaults write com.apple.TextEdit NSFixedPitchFontSize -int 14

Set the default rich text font:

defaults write com.apple.TextEdit NSFont -string "Helvetica"
defaults write com.apple.TextEdit NSFontSize -int 14

Turn off smart quotes and dashes

Stop TextEdit from replacing straight quotes and hyphens with curly quotes and dashes:

defaults write com.apple.TextEdit SmartQuotes -bool false
defaults write com.apple.TextEdit SmartDashes -bool false

Turn off smart copy/paste

Stop TextEdit from adding or removing spaces when you paste text:

defaults write com.apple.TextEdit SmartCopyPaste -bool false

Turn off spell checking

defaults write com.apple.TextEdit CheckSpellingWhileTyping -bool false

Open HTML files as code instead of rendered pages

By default, TextEdit renders HTML files as formatted web pages. To see the raw HTML code:

defaults write com.apple.TextEdit IgnoreHTML -bool true

Read all current TextEdit settings

defaults read com.apple.TextEdit

Notes

TextEdit is a surprisingly useful tool once you set it to plain text mode with UTF-8 encoding. With these tweaks it works well as a quick code editor or scratch pad.


Enjoyed this post?

Well, you could share the post with others, follow me with RSS Feeds and/or send me a comment via email.


Tags

Category:

Year: