19

See Convert tabs to spaces in Notepad++


I have started on a personal quest to learn python and after following a Google lecture online the instructor advocated changing your tabs to spaces.

I have browsed around in notepad++ and gone to the language settings and checked the change tabs to spaces text box but it is not working.

Antonio
  • 19,451
  • 13
  • 99
  • 197
ssirovi
  • 259
  • 1
  • 2
  • 5
  • I suppose this will be applied to subsequent code addition & not to the existing code. – shahkalpesh Jul 18 '11 at 03:21
  • 3
    I see this question has been closed as "off topic". Is there a preferred site for discussing programming-related problems with popular programming editors? (It would be useful if the close message stated where such a forum can be found. There are SO many StackExchange sites these days...) Thanks! – Chris Mar 30 '14 at 21:23
  • While I think that discussing programming tools can be ontopic on SO, I think this particular question belongs to superuser (http://superuser.com/) – NoDataDumpNoContribution Feb 18 '15 at 09:07
  • More than off topic, this question is duplicate of https://stackoverflow.com/questions/455037/convert-tabs-to-spaces-in-notepad – Antonio Oct 12 '17 at 21:30

2 Answers2

34

There are two places in the language settings that might be controlling tabs and spaces in Python. Check that the "default" language is set to spaces, and then check that "Python" is set to "Use default value. It should look like this:

enter image description here

Personally, I prefer using tabs. I find it's easier to make sure everything lines up correctly. Others disagree. :)

Also, to help you convert your files from tabs to spaces (or back!), have a look at the menu item TextFX -> TextFX Edit -> Leading space to tabs or tab to spaces. It makes it easy to convert back and forth between the two.

Good luck!

Chris
  • 940
  • 10
  • 24
  • 1
    thanks for the help, in fact thanks to everyone for there quick and helpful replies – ssirovi Jul 18 '11 at 03:48
  • You might find this thread on "tabs vs spaces" is interesting: http://stackoverflow.com/questions/119562/tabs-versus-spaces-in-python-programming – Chris Jul 18 '11 at 17:30
1

What version of Notepad++ are you using?

In 5.9.2, in Preferences, under the Languages Menu/Tab Settings tab, the "replace by space" checkbox should do it.

If you've done this -- are you sure it isn't working? If you go to View > Show Symbol > Show White Space and TAB, you can see if the tabs are being printed as tabs (arrows, →) or spaces (small dots, ·).

Cho Naseo
  • 96
  • 1
  • 8
  • In Notepad++ how can I make a tab be displayed as an arrow instead of as 4 dots? Currently my tabs display as 4 dots. – user3731622 Feb 15 '19 at 22:33