Mac Text Editors

I need a text editor that will print syntax highlighted Java code with line numbers.

  • Smultron doesn’t print line numbers.
  • TextWrangler doesn’t syntax highlight Java code.
  • BBEdit doesn’t syntax highlight Java code.
  • XCode doesn’t print line numbers.
  • Editra doesn’t print (it just prints the filename and the right-hand margin, leaving the actual text out).
  • TextMate doesn’t print line numbers.
  • NetBeans prints both line numbers and highlighted text, in a terrible way; printing to HTML results in print output surrounded by an inexplicable black box.
  • Aquamacs Emacs - an astonishing 115MB for a text editor even though it hasn’t got a real UI; view line numbers option doesn’t appear to work.

Why isn’t there a Mac text editor that will print properly?


Richard on 2009-02-17 at 07:18 said:

Have you tried Eclipse? On the Linux version at least, turning on line numbers and printing to pdf results in syntax highlighted Java code with line numbers. But it may depend on the platform, SWT being what it is.

ant on 2009-02-17 at 12:24 said:

I'll give that a go. When I mucked about with Java a few years ago, I found Eclipse to be the least-worst Java IDE and I've been meaning to reinstall it.

doodle77 on 2009-02-23 at 02:46 said:

You could try SciTE through macports http://trac.macports.org/browser/trunk/dports/editors/scite/Portfile GTK is a little excessively sized (30mb?) though, and it will only run through X.app, IIRC.

sole on 2009-02-23 at 10:36 said:

In TextMate: View menu -- Gutter -- Line numbers

Or Alt + Command + L

There you have line numbers :)

ant on 2009-02-27 at 12:15 said:

@doodle: I've been avoiding macports, mainly because I'm down to my last few GB of disk space and can't afford to install many more programs.

@sole: That works for showing line numbers, but TextMate doesn't include the line numbers in hard copies.

Stewart Griffin on 2009-03-06 at 00:16 said:

Have you tried asking this on StackOverflow? It would be interesting to see if you got a good answer.

Rich Siegel on 2009-03-08 at 04:28 said:

BBEdit includes syntax coloring and function navigation for Java code. I'm curious why you think it doesn't. :-)

naomi on 2009-03-09 at 17:05 said:

BBEdit doesn’t syntax highlight Java code.

Is it possible you have the language set to something other than Java? Or not set at all? Unless you want to do something fancy, like set preferences on a per language basis (prefs -> languages -> Java -> set the prefs), the easiest way is the pop-up menu at the bottom of any editing window (third from the left, or the left-most one with arrows). HTH

ant on 2009-03-11 at 12:20 said:

@Rich - Oh yes, so it does! The default comment colour isn't particularly distinct from the plain text, but it does highlight java code. Not sure why I didn't see that before; probably missed it due to trying to find something that worked in a hurry.

Still no print with line numbers, though. :P

Mason on 2009-03-29 at 02:24 said:

Use Vi.

ant on 2009-03-29 at 14:08 said:


(Downloads Vim for OSX and gives it a try.)

I'd rather chew off my own foot.

keldon on 2011-04-10 at 17:49 said:

JEdit / Komodo Edit