Notepad++ General Purpose code formatter.

5

2

I enjoy a lot that I can hit CTRL+Shift+F on eclipse and it automatically formats the code according to a profile. My question is how can I do something similar on Notepad++? Where would I go about to find a good profile for that?

I tried this answer

It didn't work so well.

makakas

Posted 2013-04-17T04:34:13.193

Reputation: 153

Answers

6

Short answer: TextFX

Long answer: (Yes i know you linked that thread, but read all the answers there) use https://stackoverflow.com/a/7029595 for the PHP, and use https://stackoverflow.com/a/3635611 for the HTML

Even longer answer: Notepad++ isnt an IDE. It is an text editor (an awesome and versatile one at that), and is only partially aware of what you are editing.

If you need such code beatifications/fixers from eclipse, then do it in eclipse (or what ever IDE of the language of your choice)! There is a PHP module for eclipse, and it works fine for this stuff. I use it every day. You can do the bulk of your coding in notepad++ if you still want, and just from time to time just open eclipse, and smack c+s+F, and then save.

Uberfuzzy

Posted 2013-04-17T04:34:13.193

Reputation: 394

Do u know if eclipse formats PHP as well? I am using few html in PHP and I dont seem to be able to get both of them formatted properly at the same time. – makakas – 2013-04-17T18:16:40.090

From some cursory testing, it seems the formater in eclipse seems to only do simple re-indenting, nearly similar (but different) to the TextFX plugin. And in both cases, its not exactly helpful. Source code is not exactly easy to just blindly modify layout. You would likely end up spending less time by just writing more cleanly written code then trying to setup a good formatter – Uberfuzzy – 2013-04-18T16:15:33.393

TextFX doesn't indent correctly in PHP. Sometimes it makes 2 or 3 tab spaces instead of one, and in some situations it makes none, when it should. – Jo Smo – 2014-06-06T06:51:15.167