Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 VS does?

share|improve this question

migrated from stackoverflow.com Oct 2 '12 at 16:33

This question came from our site for professional and enthusiast programmers.

1  
"Courier New" has serifs, and it looks like your font in Notepad++ has none. You can change the font in Settings->Style Configurator, select Default Style and set the font you want (also check if the font is set in any of the other styles in the list). –  vstm Oct 2 '12 at 14:45
    
@vstm serif or sans-serif does not matter;) –  Christoph Oct 2 '12 at 15:04
1  
Your Notepad++ font is not Courier New. –  BoltClock Oct 2 '12 at 15:05
    
Use a monospace font and it will indent correctly. –  Abhinav Sarkar Oct 2 '12 at 15:14
add comment

2 Answers

up vote 3 down vote accepted

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.

share|improve this answer
1  
The one seen in Visual Studio is Consolas. It also comes with Windows. –  BoltClock Oct 2 '12 at 15:05
    
@Bolt that's why i said available on your system, since Consolas in only available from Vista on;) –  Christoph Oct 2 '12 at 15:19
    
I missed that part. I'm tired ;) –  BoltClock Oct 2 '12 at 15:25
    
Take a nap and skip SO for today...enough rep for you;) Btw, I'm waiting for your Website Relaunch to come online for some time now;) –  Christoph Oct 2 '12 at 15:32
add comment

Thanks everyone - I will accept the other answer and upvote everything that was helpful but before I do so 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 it's 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 Sublimetext or vim...

share|improve this answer
1  
Hey, I just had the same problem as you. The solution was to check the Enable global font right under the Font style frame in your first picture - that applies that font to everything which does not have other font set explicitly. –  eudoxos Dec 4 '13 at 10:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.