14

How does one change the tabstop in TextEdit.app for Snow Leopard?

The current tabstop is 8 spaces. I would like to change this to 4 spaces.
Is there any way to achieve this?

3 Answers 3

2

Yes.

  1. Make sure Format > Text > Show Ruler is enabled.
  2. Locate the tab stops in the ruler (Fig. 1).
  3. Move the first one to 1/4 inch (Fig. 2).

Fig1 Fig2 Alternatively, you could use something like Keyboard Maestro, TextExpander, or BetterTouchTool to map four spaces to the Tab key. This is the only way I'm aware of to do it for plain text files (.txt).

5
  • 2
    If your document has existing content, select all of the content before making this adjustment so the tab stops are applied to all of the paragraphs.
    – bneely
    Feb 11, 2012 at 21:24
  • 7
    This works for rich text documents. It seems not to show a ruler for plain text documents. I'll keep this in mind. Thanks!
    – phwd
    Feb 11, 2012 at 21:52
  • 1
    Oh, sorry, didn't realize it didn't work for .txt files. Oh well!
    – Tuesday
    Feb 12, 2012 at 1:24
  • @phwd Added an alternative for .txt files. :)
    – Tuesday
    Apr 4, 2012 at 20:49
  • Sweet looking into them now
    – phwd
    Apr 4, 2012 at 20:55
32

For plaintext tabs, you don't need to replace the entire TextEdit app to change it. I looked at the source code and it provides the simpler answer: Open the Terminal and type

defaults write com.apple.TextEdit "TabWidth" '4'

Where '4' is the number of spaces a tab should be.

6
  • 4
    Fantastic, I basically only use it in plaintext mode anyways. Would upvote more if I could :)
    – Johannes
    Mar 11, 2015 at 8:56
  • Nice! Worked perfectly!
    – DaveyJake
    Aug 5, 2015 at 2:36
  • this should be a selected answer. May 26, 2017 at 13:34
  • @liquid, You looked at the source code? Textedit is opensource?
    – Pacerier
    Oct 9, 2017 at 11:34
  • 1
    Why in the world is the default 8 spaces? That seems way to large in my opinion. The default should be 4. Does anyone else agree? I'd be curious to know what other people think. Feb 13, 2020 at 4:37
1

A kindly soul has slightly modified TextEdit to add a field, "Tab Width", at the bottom of the "New Document" tab of the "Preferences" window.

Type in a number between 1 and 100 (inclusive) and it will change the width of tabs to that number (in character widths).

Download at code.google.com.

Since I couldn't replace the main TextEdit app, I used "show package contents" and replaced the inside of the app.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .