How to configure Notepad++ to indent spaces consistently

notepad

Let's say I have this bit of code in Visual Studio 2010:

Visual Studio

If I open this in Notepad++ it looks like this:

Notepad++

See that argument2 it out of alignment.

It is not super clear, but in Notepad++ you can see that I am using spaces and not tabs and the font is Courier New (10 pt), which I believe is monospaced (incidentally I am using the "obsidian" style), but it seems like spaces are taking up less space than the characters (about half as much space if you count the dots under public. You can see that four of them cover only to the u).

So what am I missing here – does anyone know how I should configure Notepad++ to display my code aligned like Visual Studio does?

Best Answer

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.

Related Question