How can I configure Notepad++ to indent spaces consistently?

The font you currenty use is not monospaced, meaning the letters have different width. To achieve the effect you want, you need a monospaced font for that (it doesn't matter if it's a serif/sans-serif font).

Best (free) fonts for writing code are imo:

INCONSOLATA
SOURCE CODE

but you can just use Courier New, Consolas or any other monospaced font available on your system.

Settings->Style -> Font and then select the font you like.


I will explain what the actual problem and solution were...

  • I had Courier New set as the Global Styles | Global Override option like so:

Global

  • And I had Global Styles | Default Style set to Courier New also like so:

Default style

  • In the C# area I had no explicit style selected like so:

No style for c#

At this point I asked the question because I figured I was in Courier-New-monospace-land. Clearly I was not...

After a bit I thought, what the heck...I did the last thing remaining to me and went through every option in C# and set the font to Courier New like so:

C# explicit

And low and behold I had Courier New goodness, and it lined up!

Now, not to be someone who gives up I thought a bit longer about the actual options contained therein and rolled back to the situation where I had no explicit option set and then I set just the COMMENT option like so:

Just comment

And that was it!

It seems that for whatever reason the comment did not inherit its font (and a space is considered a comment) and therefore the indentation went all awry.

OK, now that's over I think I will go and have a look at Sublime Text or Vim...

Tags:

Notepad++