Via Twitter, mikeymikey told me about the x-man-page:// URL scheme, which I had somehow never heard of before. As for the AppleScript in Lines 18–23, you’re on your own. You’ll have to change the bbedit to whatever command invokes your editor. The lines that handle the arguments should stay the same, as should the Line 15 up to the last term in the pipeline. If you use a text editor other than BBEdit, you can probably adjust the bman script to fit your needs. Unfortunately, during one of Apple’s many fits of automation hatred, the online man pages were either deleted or moved to such a secure and undisclosed location that even Google can’t find them anymore.
1 Accessing them from a web browser was certainly slower than getting them locally, but the online versions were nicely formatted with proportional fonts. Also, the -x option turns tabs into spaces, which I’ve found helpful in keeping the text aligned the way it should be.Īpple used to have all of the OS X man pages online. The man command outputs a lot of weird control characters to create bold and underlined words, and the purpose of col -b is to filter those out. What may be unfamiliar to you is the col command in the pipeline on Line 15. I think I’ve put enough comments in to explain what’s going on. As with `man`,Ĥ: # the section is optional and comes first if present.ġ3: # Get the formatted man page, filter out backspaces and convert tabsġ4: # to spaces, and open the text in a new BBEdit document.ġ7: # Set the document name and cursor position within BBEditĢ1: select insertion point before character 1 of front document If the man page is long, I can use all the familiar BBEdit search commands I use every day to find what I want.ģ: # Interpret the arguments as command name and section. For example, bman col will pop up this window: Using the same basic structure as man itself. I invoke it this way from the command line, bman command Since I always have BBEdit running, this works just about as fast as the regular old man command. To get around this problem, I wrote a short shell script, called bman, that opens the man page in a new BBEdit window. The main problem with the man command is that it takes over your terminal window-you can’t refer to it while you’re constructing a command unless you open a second terminal window first or use the control-click trick. The other, in Section 3, covers the printf function from the Standard C library. One, in Section 1, covers the printf user command, which you can run interactively from the Terminal or put in shell scripts. For instance, there are two man page entries for printf.