How can I set Notepad++ to indent with spaces?
I would like Notepad++ to automatically indent using spaces if the previous line is indented using spaces, and with tabs if the previous line is indented using tabs. I know that this can be done by enabling the “Replace tabs with spaces” option, but I wouldn’t like to lose the ability to add tabs when I want to.
currently, I don’t see that this can be solved by using npp builtin features/settings
and I’m not aware of a plugin which does this.
I can think of a python script doing it if you are willing to install python script plugin.
In case you are - please don’t install the plugin via plugin manager instead use the msi
package from here.
There are at least 3 related fixes that I wanted in this area and implemented for myself.
- New line will be indented according to the indentation style of previous line.
- When a line indent is modified (add/remove tab) the indent will be according to current indent style and not according to global style.
- When pressing multiple ENTERs to add blank lines the last line should be indented automatically but blank lines should be empty and not with indent whitespace.
Can’t tell if everyone will be happy with such behavior but when working with code from multiple sources and attempting to respect each source style current Notepad++ indentation is quite annoying.