ChatGPT解决这个技术问题 Extra ChatGPT

How do I configure Notepad++ to use spaces instead of tabs?

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?

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 correct
This question should be closed as it is off topic. This question belongs on Super User
@MikeCaron That is incorrect See meta.stackexchange.com/questions/61726/…
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: 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.

P
ParkerM

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.

https://i.stack.imgur.com/qdVPO.png

See documentation: https://npp-user-manual.org/docs/preferences/#language


Ah Language, now that makes sense.
The Notepad++ documentation is way outdated. The link above points to Tuxfamily, and they started releasing new builds on Tuxfamily back in 2010. The online documentation site on Tuxfamily was published in 2011 and it's for version 5.8.7. Notepad++ is at version 6.5.5 right now, and the "Help Contents" menu option brings up a local copy of the doc site. Visiting Tuxfamily site returns a 404.
It's unfortunate that the doc site is so outdated. But the screenshot above points correctly to the appropriate option (version 6.5.5). So this setting is located under "tab settings" now, it's no longer shared with "language menu".
The setting is now under Language, instead of Tab Settings.
Well, now the Notepad++ actually always inserts tabs as spaces, even when the checkbox is unchecked.
F
Florian Feldhaus

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.

https://i.stack.imgur.com/FFmo7.png


This is the new settings for latest Notepad++
S
SharpC

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

https://i.stack.imgur.com/T8esO.png

https://i.stack.imgur.com/G5qV2.png