I have been using UltraEdit as my primary text editor over the last few years. I thought it had all the features I could expect from a text editor : tabbed interface, syntax highlighting for a number of languages, code block collapsing, regular expressions for searching and replacing, opening and closing brace matching, you name it.
Then, recently, I got more and more annoyed by the weaknesses of the code highlighting feature. For instance, UltraEdit gets it wrong if you use heredoc syntax (using something like <<<HERE and HERE; as delimiters for a string) and can't parse and highlight properly your code.
One night, someone in #wordpress mentioned they were using PSPad. I realized that, after all, I had been using the same text editor over the years simply because I had never looked if something better existed. So I loaded my gun and went for a little hunt, hoping to find the perfect text editor. UltraEdit, Notepad++, PSPad, EditPlus, EditPad Pro, Crimson Editor, GridinSoft Notepad, HTML-Kit, I tortured them all with my binary and merciless 10 seconds review tool: the Tricky Code Snippet From Hell.
The test
I made up a short and catchy text file filled with traps I knew most editors would fall in, which consisted of the following :
- <?php
- $pattern = '(<body[^>]*?>';
- /* abcdef
- multi-line
- */
- $hello = <<<HELLO
- <<<<--! jk -->
- >>>
- /*
- abcdef
- HELLO;
- function echoit($pattern) {
- echo "123 456 $pattern";
- echo '123 456 $pattern';
- foreach (array(1,2,3) as $val) {
- echo $val;
- }
- }
- echo "/*";
- echo '//';echoit($pattern);
- ?>
From this incongruous yet efficient snippet, I was expecting to check, at a glance and in less than 10 seconds, the following 9 tests:
- Line 3: will the editor think the regular expression pattern is actually the closing ?> PHP tag
- Line 5 to 7: can you collapse multiline comments
- Line 9: heredoc, part one, does the editor understands we're just defining a string
- Line 12: heredoc, part tow, does the editor gets that we're not starting a multi line comment
- Line 16: can you collapse regular code block
- Line 17 & 18: will the editor display differently these two lines(variable in the first one, just text in the second one)
- Line 19: how will the editor display nicely (or not) the nested code folding marks
- Line 24: will the editor think we're starting a multi line comment
- Line 25: will the editor think we're commenting out the line
You've already noted that the in-blog code highlighter I'm using failed on line 12 and test #4 :) How did the desktop software did?
Results and verdicts.
Crimson Editor
I didn't know this software, but it was in Google's top results for "text editor" and looked decent, so I gave it a try.
Miserably fails at line 12 (while still being able to highlight matching braces within what it thinks is a comment), and you can't fold code blocks.
Verdict: Sucked.
EditPad Pro
Again a software with a good ranking within Google's search results. It produced:
Incoherent results: fails at line 3, while still giving folding marks for the whole file (does it end on line 3 or not??), you can collapse a function block but not the nested foreach block. That's too bad, because the highlighting abilities were not mislead by the heredoc and its deadly line 12, and it does make a difference between line 17 and 18. Almost passed.
Verdict: Sucked.
EditPlus
I was recommended this software by some friends.
Oh, my. I hope we're still friends. Died at line 12.
Verdict: Sucked.
GridinSoft Notepad
Another software I didn't know and that was waiting for abuse within Google's top results.
Pathetically fails at line 3. By the way, I don't understand why it highlighted HELLO that way.
Verdict: Sucked.
HTML Kit
It was recommended by a friend, so I gave it a try despite its name making me thinking it was more HTML oriented than anything else.
The highlighting abilities are decent, it doesn't get fooled by line 3 and the confusing heredoc. Making no difference between line 17 and 18 is too bad, and not being able to collapse block is a no-go with me.
Verdict: Sucked.
PSPad
I read about it on #wordpress as a coding tool of choice, so I had a good a priori here.
Failed at line 3.
Verdict: Sucked.
UltraEdit
The software I thought was the Rolls Royce of editors for years.
As I knew it, UE understands nothing about heredocs, which is really too bad considering that without this line 12, it would pass every other tests.
Verdict: Sucked.
Hey… No winner ?
Ho, you noticed, all the softwares mentioned got the "Sucked" grade (some well more deserved than others, I'll fairly admit it). No winner, then ? Of course there's a winner, would I bother writing such a useless review otherwise ? :)
Notepad++
I started using Notepad++ two years ago on my computer at work because for some reason I couldn't properly install UltraEdit (I guess my user limited privileges on Windows 2000 were to be blamed), and had sticked with a very old version of it, till I even had the idea of upgrading to the latest version for this test. Boy, that was a good idea.
Syntax highlighting is just… perfect. The heredoc does not fool the software, line 17 and 18 are perfectly shown. The only thing I'd miss is the ability to fold comment blocks (line 5 to 7) but it's pretty minor to be honest.
Edit: Klaue, a reader in comments, points out that you can actually fold comments. It just doesn't work with PHP, apparently. Sounds like a bug then!
Notepad++ passing the 10 second test, I looked at the rest of features and abilities a simple glance and screenshot cannot reveal. To my pleasure, everything I need is here: search and replace with regexp, bookmarks within your text files, 3rd party plugins, loading and saving "sessions" to work on a predefined group of files. The software came with a very very handy plugin that shows real time a list of functions defined in your text file, which makes it really easy to navigate through your code with a single click on the function name.
In short, I love this software. Did I mention this is freeware ? Give it a try, you'll love it or I'll refund !
Shorter URL
Want to share or tweet this post? Please use this short URL: http://ozh.in/ez
No idea why, but I read that entire post… Thanks for the info though. I just downloaded Notepad++ and I love it. I was using PHP Designer 2007 Professional and it definitely was not doing the trick.
I've tried all (and a couple more) the text editors shown here and personally for me the most impressive one is EditPlus, it can do many things like search within folders and so on. Notepad++ comes at second and also a very good one you haven't talked about is ConTEXT.
Alix » indeed, search&replace in folders is a really neat feature of EditPlus. I sent an email to Notepad++'s dev and this was one of my suggestions :)
Nice review.
I sent your copy of Translator on 17th. I am very surprised that you still didn't receive it. I am sending it again from my GMail account; last time I used Taragana.com account.
Please confirm receipt. You can also download it from the download site ( http://taragana.com/download/ )using your PayPal transaction id that you received in email after payment.
just a test under kate, the kde text editor under linux :
[img]http://bb2k.org/images/kate_stresstest.png[/img]
BB » perfect!
I used to use Notepad++ and I really did like it. But if you want something a lot more powerful then try Komodo Edit.
It's not the fastest to load up but apart from that it's hard to fault. Possibly my favourite feature is when you are working on multiple PHP files and you want to use a function from one of them, not only does it auto-complete the function name but it'll also give you a list of attributes required and the comment above the function. This means you never have to go hunting for how to use a function, it's all displayed for you automatically.
I've also got a couple of macros that give it a nearly TextMate style snippets.
Oh, and here's an image of Komodo rendering your test.
Tom » thanks for this info, indeed I didn't know this software and your screenshot says it passes my 5 second test so I'll have to have a deeper look. I'm just a bit amazed at the size of the download, 26 MB for an editor seems a bit overkill to me, unless it has really serious features beyond editing of course. I'll have a try, thanks for this link.
I am a mac user and I prefer BBEdit (from barebones software) as a text editor.
I don't have any idea what that script you formed does, but I've been using BBedit for about five years for most of my html coding. I can program web pages in html and xml, use css, and make some pretty killer tables. BBEdit has been a reliable tool for me.
It does have color coded syntax, patterned search and replace, and lots of other things you might find useful. They also have a freeware version called "Text Wrangler" but as far as I can tell, the free version doesn't offer the color coded syntax, which makes it useless to me.
brandyS » my code does nothing (or just prints stuff). Its point is not to be executed at all, it's just to be read within a text editor. As for BBEdit, I'm a Windows user.
You missed a very popular open source text editor: Scintilla Text Editor (SciTE). You can find a screenshot highlighting your example code here.
Oh, and what I missed about SciTE:
– SciTE is portable (put it on your USB-Stick with the config-file).
– It has many standard features not shown on the screenshot (parenthesis highlighting, search and replace using regular expressions, find in files, …).
– There are a lot of configuration options to make SciTE fit your needs. Only drawback: you have to configure them using configuration files – there is no GUI to do this. You can configure SciTE for every "language" differently (HTML, PHP, C, JavaScript, …).
– SciTE is fully scriptable using Lua as scripting language. You can extend SciTE using Lua to suit your needs. Some examples: Running tidy on your HTML, stripping spaces at the end of the lines, fixing identation, compiling your code, running your code, …
– SciTE runs on Windows and Linux (could be ported to Mac OS probably).
Jens » I think I've tried it but I didn't like it, can't remember why. Probably either not tabbed interface, or something requiring additional libraries to display (something like GTK or stuff like that ?)
I support SciTE choice. It has tabbed interface and doesn't need any specific libs to run (on Win98/XP that is)
My coworker uses Notepad++ and I find SciTE much better (duplicate lines, transpose lines, commenting/uncommenting – both HTML and C comments btw, and customizability (Wordcount script for writers ^^))
What abaut TextPad++, have you review it yet?
wow.. thanks Ozh. your post and the comments are really2 useful. now i use notepad++. and (@Jens Remus) it's portable too isn't? it doesn't need to be installed. i can run it from everywhere. i really love the tidy feature.
thank Ozh.
Ohh.. I revise my statement.
notepadd++ sucks on me :(
somehow, while i copy from notepad++ and paste on my blogger html editor, the code was changed! looks notepad++ convert some character or something! now i'm back to textpad :(
This is so funny, I've been reviewing php editors myself and discovered Notepad++ the other day and came to the conclusion it was the best for me too. It also has much more control over the visual colors and font sizes than others like pspad.
I just wish I could put a little margin on the left side of the text somehow, I don't like it right up against the "folding" line. Oh well.
[…] this out, OZH (a well known WP plugin author) came to the same conclusions about choosing Notepad++ (but for technical […]
[…] my favorite text editor, has been updated (changelog, binaries) Share This Related […]
I used Notepad++ for months, thinking it was the bee's knees. But then I found PSPad a few weeks ago, and it's earned the title as go-to editor. Tabbed Interface, multi-code-highlighting, projects, text diffs, many user-created extensions, etc. etc.
But what sealed it for me was built-in site management over FTP. Work with remote files as if they're local. Couple that with ability to run from your USB drive, and you've got a powerful, anywhere, any-code editor.
My only task now is to find (or write) the handy "duplicate line" function from Notepad++…
Sean O » I find PSPad's highlighting abilities quite average. Nice software other than that. But so behind N++ :)
How is his a comparison of text editors when you don't evaluate them on their ability to actually edit text?
tom » Wow. This is probably one of the silliest comment across my whole blog.
Actually, you can fold comments in Notepad++. It just doesn't work for PHP (try to select C++ in languages and you can)
Maybe you should write this in case someone uses the article to choose a texteditor for a non-php language
Klaue » ho, nice, I didn't know this. Thanks!
I've been using NP++ for about a year now. It's truly great, isn't it?
A couple features I use a lot are:
find/replace in all opened documents
regex find/replace
Nice read. I love PSPad and Notepad++, they are probably the only 2 text-editor (not IDE!) that you will ever need.
I tested the code in E-Texteditor and it seemed to pass all your requirements. It could even fold multiline comments but it gets fooled at line 12 and 24 as it doesnt know where it ends and therefore collapses to the end of the file.
Ozh, i came to the same conclusions that you did. but i have to have live tag matching.
try dev-PHP or anything else that uses the SynWeb component: http://flatdev.ovh.org/downloads.php?project=2
they all pass your php syntax test, are as good if not better than all scintilla-based editors like notepad++, notepad2, programmer's notepad2, sciTE etc. plus you get live HTML tag matching.
depending on the implementation tho, you may or may not get tag and attribute code hints (for css and html), tag auto completion, and color picker and file path browse dialogs which are the only other things i would like to see to greatly improve usability. php designer is not free, but has a ton more stuff that makes it the best php editor i think w/live syntax checking, xdebug, ftp, SVN etc.
Leon
The version of EditPad Pro that I'm using (6.3.2) does not presume that line 3 is a closing tag, and the editor will autofold comments and For loops if you set one of its configuration options to generate folds based on text indentation (not perfect, I realize, but better than nothing).
Whilst Notepad++ has great syntax support this is due to the component used and the the person who makes the program. But as someone else has commented it takes more than good syntax highlighting to make a good text editor. I have used both PSPad and Notepad++ and always return to PSPad. My main reasons for this is that PSPad has a better list of PHP functions and can complete them as either just the function and parenthesis or as the complete function and attribute descriptions as taken from php.net. And I just tested your test code on PSPad and switched it to PHP highlighting and not HTML multihighlighter and it passes line 3 fine but fails on the heredoc. Also I find PSPad easier to use and it's configuration makes more sense.
Just to add that Notepad++ does now have FTP support.
I just wonder, which of the editors supports regex syntax that oneself can make?
Notepad++ code snippet's hotkey (quicktext plugin) is Ctrl Enter — which is a great downside for me. i think people has cried out for the Tab hotkey for ages now :)
and i tried to fix that — i hope
https://sourceforge.net/forum/message.php?msg_id=4991463
Great list, personally I have been using phpDesigner in windows and I find it quite nice especially since it highlights syntax errors such as a missing ";".
Might as well test it with your tricky code when I get home. Using linux however, I really love Gedit (Gnome's default editor) just tested your code there and it has no syntax highlight flaws, its only missing the collapse option. What I really like about it though is the ability to use it with gnome's ftp connections and open/save as if remote files were local.
Regards
A different HEREDOC identifier SHOULD change the code styling within the HEREDOC part appropriately and NOT just assume every HEREDOC is a GENERIC quoted string. In the example below I want it to parse the heredoc part as JAVASCRIPT with matching JAVASCRIPT code styling!
ie)
$language = <<<JAVASCRIPT
This is invalid javascript.
The <<<JAVASCRIPT code styling here SHOULD be screwy (NOT necessarily a solid color)
<<<
>>>
/*
abcdef
JAVASCRIPT;
ie)
$language = <<<JAVASCRIPT
/* This <<<JAVASCRIPT SHOULD have JAVASCRIPT code styling.
It SHOULD NOT all be the same color! */
var stlyled;
styled = true;
JAVASCRIPT;
Is there a text editor that can do this?
Textmate can do HEREDOC code styling as long as you update the PHP bundle to the latest one. See:
http://macromates.com/
To update the PHP bundle after installing textmate change "Python" to "PHP" in the terminal commands on the following page:
http://blog.macromates.com/2006/updating-a-bundle/
Notepad++ fails HEREDOC if encoding is MAC .. just an FYI cause it had me pulling the last of my hair out….
I can't believe nobody mentioned VIM (http://www.vim.org/)!
VIM 7.2 with the default PHP file type renders your snippet perfectly.
I have been programming for 6+ years using textpad, it it a light but very powerful text-editor it is shareware though, but you can use it forever..
What i Love about it is:
1. Very Fast To Load
2. Has Simple To use but Powerful Macro Programming
3. Tabbed Interface
4. Can do Search using text/hex, or regex, and can search through files and folders….Very fast too.
5. You can download any syntax color highlighting for free, from textpad.com
6. Tons of macros and tools there as well all free.
7. You can adjust the colors of each file type to fit your own needs or needs of your graphics/monitor.
8. Can easily change case of code/text in blocks to any case, upper, lower, capitalize, sentences
Just a powerful old-skool text-editor…
Notepad++ fails unfortunately if the end tag of a heredoc – in this case, HELLO; is tabbed away from the margin in anyway.
Tim » It's normal. Heredoc are supposed to be on their own line, not indented or tabbed (at least in many languages, PHP & Perl for example)
Oh right OK. I didn't know, slightly frustrating though when I want to place them within IF and SWITCH statements… or is this not the done thing? Sorry more of a scripting question!
Tim » indeed it can break your neat block indentation :) But there's nothing wrong with this, except for the aesthetics of your code of course
After all this time your posting here still gets high SE listing, OZH ;^)
To chime in… I have been using EditPad Pro for soem years now, but occasionally (like today) look around for alternatives. I am compelled by your text highlighting / handling comparison. I tried your test in the latest EPP and it succeeded at everything except added collapsing for the nested Foreach statement.
Today I briefly looked into Notepad++ and TextPad. Some quick comments…
1) Language selection in EPP is as easy as selecting from a drop-down menu. Finding other or custom languages (or customizing installed ones) is a snap
– NPP appears to have similar/o-par capability
– TextPad's handling seems a bit clunky and not well thought out (difficult to use)
2) I rely heavily on the Project Grouping capability of EPP. I can open several projects ('Workspaces' in TP, 'Sessions' in NPP) each having its own dedicated tab (I set it up so they are along the bottom of the open documents' window-panes). Select a Project tab and all the document tabs at top shift to the current project.
– TP cannot open multiple workspaces at the same time.
– NPP 'can' open another window instance and then you can load a unique session in it, so the ability is there, but it feels a bit clunky,
– you have to have multiple windows open
– there's no menu or anything at all to help you determine which session you have open, may be working in, or to navigate them… so its not really a supported feature, only this "workaround" kinda gets you there.
Would not be practical if you rely on managing concurrent workspaces/projects/sessions, but then I am a bit spoiled by EPP's advanced handling of this.
3) In EPP I like being able to write custom command sequences for files, or code within files (like select a line, or group of lines, and run them). EPP supports complex configuration of such, and a handy menu for running them. It also sports a results pane. I do not think you can set break points in EPP, but reporting is excellent (ec: dll call and handle reports are very detailed making troubleshooting a snap).
– TextPad and NPP both have similar features, albeit seemingly not near as diverse or easily manageable -but I didn't spend time with it [yet], so I could be shortchanging them. I have no feedback on their reporting depth or capabilities. TP has a report pane, I do not readily see it (or find it) in NPP.
4) EPP does not wrap document tabs… I sorely wish it had this.
– TP doesn't either
– NPP does
================
I really want to find a features comparison chart that looks at these great editors being discussed here. If anyone knows of something decent in this regard please do post ;^)
Thanks for this article, Ozh!
The thing about the heredoc failing with UltraEdit that does not bother me is this… I hate the heredoc syntax, because it messes up the indentation level of your code. You can accomplish the same thing as heredoc in PHP by simply using a "multi-line" string.
For example:
echo "This is the first line of a string
this is the 2nd line
3rd line
and so on.";
Multi-line strings are my preferred method of doing things, especially since it is just plain "easier to read and understand." When you work between multiple programming languages, it is also the most portable.
Given this, and the fact that Notepad++ can't handle alternation (|) in regex find/replace, and Notepad++ can't handle large file support or even multi-line regex find/replace, then UltraEdit wins hands down. Those are features I use regularly, and Notepad++, while a fine text editor, just doesn't do what I need.
UltraEdit might not be perfect (none of the others are either apparently) but it has Column Mode edit where you can edit multiple lines at once, make vertical selections and edit those, insert e.g. multipl lines of a href=" and then make a new selection over the lines to make closing brackets, which is just too insane to fathom until you see it. Then you are hooked.
I'm curious why that hasn't even been mentioned. I think it's a unique feature of UltraEdit?
I thought I would share a relatively new editor that can stand up to this challenge.
SublimeText has risen to the top of my list, and it is worth noting that it highlights this appropriately.
http://i.imgur.com/i2h88p5.png
EHLOVader » It fails, line 17 and 18 are the same, they should not