393
votes

Notepad++ keeps inserting tabs which later messes up my code. This doesn't just happen when I hit the tab key, but other times as well. I want it to use 4 spaces instead of tabs.

How can I make Notepad++ insert spaces instead of tabs?

3
The linked question is not a dupe. This is not asking about how to run a macro that converts, it's asking about never entering tabs in the first place when indenting your code for you. And the answer here is correctJuan Mendes
This question should be closed as it is off topic. This question belongs on Super UserMike Caron
@MikeCaron That is incorrect See meta.stackexchange.com/questions/61726/…Juan Mendes
And for Python, this makes the difference between correct code and not. IMHO, Notepad++ should be shipping with this setting turned on by default for Python code.Omnifarious
@Omnifarious: v7.8.6 (April 2020) has the python option set to use spaces. Not sure how long this has been there. As a side note...Notepad++ is awesome.AlainD

3 Answers

640
votes

Go to the Preferences menu command under menu Settings, and select Language Menu/Tab Settings, depending on your version. Earlier versions use Tab Settings. Later versions use Language. Click the Replace with space check box. Set the size to 4.

Enter image description here

See documentation: http://docs.notepad-plus-plus.org/index.php/Built-in_Languages#Tab_settings

63
votes

In my Notepad++ 7.2.2, the Preferences section it's a bit different.

The option is located at: Settings / Preferences / Language / Replace by space as in the Screenshot.

Screenshot of the windows with preferences

2
votes

I have NotePad++ v6.8.3, and it was in Settings → Preferences → Tab Settings → [Default] → Replace by space:

NotePad++ Preferences

NotePad++ Tab Settings