Printing Code Like It's 1989

Which made me laugh, the 2016-2021 dialogue and still not implemented feature in that bug report is everything you love about Microsoft-controlled "open source but not really".

I've only ever printed code from BBEdit in the last couple decades, let's see how other editors fare:

  • BBEdit: Perfect. Print command in menu (it's a native Mac app!), prints headers, page & line numbers, nice margins. Looks perfect, like an old-timey print job. I should probably have switched from dark to light theme, but it'd be fine. ★★★★★
  • Geany: Print command, several settings in Preferences, prints headers, page & line numbers (in settings, choose either headers or page numbers at bottom, or it'll be duplicated). Hideous non-native GTK app and dialogs, but does the job perfectly well. ★★★★½
  • MacVim: Print command, produces a postscript file which immediately opens in Preview, spins a while, converts to PDF. Default has no line numbers, add set popt=header:2,number:y to your .vimrc. ★★★½☆
  • Atom: No print command in the menu, but there's multiple packages 5-6 years old, they work fine. Only shows line numbers, bad margins, it's literally a web page being printed. ★★★☆☆
  • Sublime Text: Print command, but no settings (in the horrible JSON text editor where you do settings) to make it nice. Literally dumps a web page, no page or line numbers. What's the least you could do and check off the feature? That's how subl does everything. ★★☆☆☆
  • Xcode: Takes forever to start. Prints in grayscale, which is nice, but no headers or line numbers. Fail. ★★☆☆☆
  • Panic Nova: … My demo expired, and cleaning the configs out doesn't let me try again, so who knows. Can't even give them a second try without paying $100. Trashed.

I'd be interested in seeing how others fare, and on non-Mac platforms if they have any consistent print command.

Here's a zip of PDF prints - is a silly Python program, but at just 3 pages it's a good test case.

Sublime or Sub-prime?

Because I'm endlessly evading responsibility^W^W looking for more efficient ways to work at nothin' all day^A^K look, I play with new editors.

Ugly themes, right away, install Package Control, and then the theme Dracula, and it looks like something I can stand. Not as good as Hackerman for Atom.

It's still ludicrously using stacks of JSON files for settings; 700+ lines in the default, OS overrides that, then your user prefs override that. Read lines, figure out if the default is useful, copy & modify in your own.

It does have the advantage it works reasonably fast, and runs on multiple platforms. It has a Lisp syntax highlighter that doesn't completely suck on Scheme.

But it has this terrible minimap, and no setting for it! You have to disable it from the menu every time you make a new window. OR, you can hack on it. Prefs, Browse Packages, make a Python file User/ (found on StackOverflow, ugh):

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sublime
import sublime_plugin

class MinimapSetting(sublime_plugin.EventListener):
    def on_activated(self, view):
        show_minimap = view.settings().get("show_minimap")

Then add "show_minimap": false, to the prefs file, and the stupid minimap never shows back up.

Problem 2, I wanted to insert timestamps in my headers. No datetime function or snippet or whatever.

Make a folder Datetime next to User, file Datetime/

import sublime
import sublime_plugin
import datetime

class DatetimeCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        self.view.insert(edit, self.view.sel()[0].b,

Note all the name cases matter. See that horrible self.view.sel()[0].b? That's how you get the current cursor position. WTF!

Next to it, make Default (OSX).sublime-keymap:

    { "keys": ["shift+ctrl+t"], "command": "datetime" }

And now Sh-^T will insert a chunky ISO8601 datetime. Good enough. (originally I did Sh-Cmd-D, but turns out that's duplicate line which I use sometimes)

So, I'm giving Sublime 4 a ★★☆☆☆ out of the box, the API is ugly as hell and they no longer have example code up so ★★★☆☆, but it's pretty hackable if you don't mind getting your hands covered in code guts, so maybe ★★★★☆

I'll give it another week and see if it's worth using longer term. BBEdit's infinitely better for giant text files, but I do have needs other than that.

Man, that Bachman & Turner concert… they're super old, and that was 2012. But Paul Schaeffer, minus the World's Most Dangerous Band, jamming out on the keyboard! The audience are too old to dance. But they still rock out pretty good for guys who are even older than me.