21

Occasionally, I use Notepad to edit some form of code/html, which means I need to tab a lot. The default indent size when hitting tab is eight spaces when ideally I'd like it be four.

Is there any way to change this setting?

aligray
  • 592
  • 1
  • 5
  • 19
  • 6
    Just in case someone's wondering "why stop at every 8th column?" This is the standard for text mode which DOS and Unix/Linux are consistent with as well. Since Windows Notepad was provided for Windows users to edit plain ASCII text files, most of which would have been created in a pre-Windows text mode editor that likely implements tabs in the same manner (because plain ASCII text file users would expect this behaviour), it was important to preserve the tab stops consistently to ensure accurate editing. – Randolf Richardson Jun 18 '11 at 05:31
  • 3
    I'm suprised no genius ever has reverse engineered Notepad to hack in this much wanted change... – Gras Double Mar 06 '15 at 16:13
  • @GrasDouble, it doesn't need to be genius to create a notepad clone, neither it worth to reverse engineer it. – milevyo Feb 15 '19 at 18:21

4 Answers4

13

Not with Window's Notepad, but the default tab for Notepad++ (free) is 4 characters. And it does A LOT more.

http://notepad-plus-plus.org/

Gras Double
  • 1,068
  • 12
  • 20
KCotreau
  • 25,519
  • 5
  • 48
  • 72
  • Good plan! By the way, I don't mind getting my hands dirty in the registry. – aligray Jun 18 '11 at 05:01
  • 2
    @aligray It is hard-coded as I expected, but I actually did search the registry before answering. – KCotreau Jun 18 '11 at 05:03
  • Appreciate that, I'll just stick to Notepad++. – aligray Jun 18 '11 at 05:04
  • There's also [Notepad2](https://www.flos-freeware.ch/notepad2.html) by Florian Balmer. It has crashed me only once in about ten years. Light-weight and yet feature-rich. • And of course you can change the tab width hitting `Ctrl-T`. – Lumi Jul 23 '23 at 15:04
1

the way i use the windows internal notepad (short notes, quick edit things,...) is with AutoHotKey. i replaced the tab-key with a little loop to send spaces instead like this:

#NoTrayIcon
return

#IfWinActive ahk_exe notepad.exe
tab::
  loop 2
    send % A_Space
  return
#If

that loop 2 means, its sends 2 spaces. it can be a part of an existing script, like i do or as a single script in autostart.

ScudMcFox
  • 21
  • 2
1

Windows Notepad is VERY old. It existed before Windows. Here's a little known "undocumented function":

  1. Create a new text file using Notepad.
  2. Type .LOG as the first four characters. (They must be uppercase).
  3. Save and close the document.
  4. Reopen it.

I create a document named MEMO.TXT wherever I work (I'm a free-lance consultant), and use the document for quick notes -- during phone calls, meetings, as reminders, etc.

  • 3
    How does this answer the question, which is "Is it possible to change the default tab-size in Notepad?" – Andrew Morton Dec 09 '22 at 18:13
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 09 '22 at 18:35
  • 1
    This does not provide an answer to the question. Once you have sufficient [reputation](https://superuser.com/help/whats-reputation) you will be able to [comment on any post](https://superuser.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/1161075) – DarkDiamond Dec 09 '22 at 18:36
  • This doesn't answer the question but I didn't know this so +1. • This is akin to the concept of a "modeline" (such as found in Vim) which is what I was looking for when coming here. It allows you, by writing a magic line in a file, to have file-specific settings, for example to set the tab width to 20 to write simple TXT tables. Quite useful. But neither Notepad nor Notepad2 appear to have the "modeline" feature - except for the special `.LOG` case you pointed to. • And by the way, [Notepad2](https://www.flos-freeware.ch/notepad2.html) has the `.LOG` feature, too. – Lumi Jul 23 '23 at 15:12
0

Windows notepad doesn't allow to modify the tab length. This is one of the motivations cause I have replaced it with notepad++ that does a lot more and allows the user to set the tab length as well: go to the menu Configuration > preferences > tabulations. In this mask there is the option to set it freely. How to replace ms win notepad with notepad++: Download n++ from the developer web site and when you install it the install wizard at a certain point shows an option to replace the built in windows notepad: check it and continue the setup procedures. Done. From now on you can enjoy the power of one of the best free text editors.

willy wonka
  • 111
  • 3