Reputation: 502
It is very close to the reverse of this question.
I prefer coding with 2-whitespace indentation, but I need to have files indented with tabs to align with the project convention. I would like to preferably automatically convert two spaces upon entry to a tab symbol in Notepad++ and have the editor configured to a tab length of 2.
A possible manual way for doing this could be Edit → Blank Operations → Space to TAB, but this converts all of my spaces to tabs, even those of length 1 - which are, for example, spaces between function arguments, not just leading spaces.
In a perfect case scenario, I'm trying to achieve a formatting style as described in this question, but with typing just spaces and the editor taking care of the rest.
I'm on Notepad++ 6.0, but I am willing to upgrade if this helps.
Upvotes: 8
Views: 12261
Reputation: 116
Let me complete the answer of Ari Okkonen to add a workaround to the problem commented by Sergii Zaskaleta of mixed tabs and spaces at the beginning of the line.
Upvotes: 8
Reputation: 165
A manual way that seems to work: After having edited the file before saving you may try (Works in Notepad++ v6.8.3):
Upvotes: 5