Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic indentation for Python in Notepad++

I've been googling lots and this is getting really frustrating. It doesn't act like idle.

Example:

else:       name = 'World'     print 'Howdy', name     print 'yay' 

but in Notepad++

else: # i press enter and this is what it does lands me here 

But I want to be able to do like in idle: after the : I can just press enter and keep on going. My English isn't that great.

I have my filetype set to Python etc. and my format to unix.

like image 591
Joe Avatar asked Apr 03 '11 21:04

Joe


2 Answers

This is what you want:

Settings > Preferences > MISC. > Auto-Indent (checkbox)

--

Sometimes people ask, "How can I do x in program y?"

I have a dream that one day "Use program z instead" will not be the most popular response.

like image 189
Thomas B. Avatar answered Sep 19 '22 07:09

Thomas B.


I played a bit with python in Notepad++ and I had a problem with the tab. Since in python your indentation is really important but notepad ++ put space instead of a tab.

So to change to tab you need to go in notepad ++ Menu Settings > Preferences... then select Tab Settings Then select python in the Tab Settings box and uncheck Use default value and check Replace by space.

Like the other answer, you might want to consider another ide. I personally use eclipse with the pydev plugin and django plungin. Erik is nice too.

like image 34
Chris Avatar answered Sep 20 '22 07:09

Chris