#BBEDIT COMMENT TEXT MAC#
Unfortunately, instead of just allowing you to type in the path to the command, BBEdit forces you to click the Choose… buttonĪnd then work your way through the usual Mac file picker sheet. This is nice because it gives you access to all the command line tools from within the graphical Factory building window. They don’t have to write a script to get this kind of filtering Bill Joy put it in right from the beginning.Īs you can see in the top screenshot, one of the actions available in Text Factories is to call a Unix command to act as a filter. They’re what I think of first when I need to filter some text. I find commands like sort and fmt easier to use than their Text menu equivalents because I’ve been using them a long time. Is this easier than first running Text‣Hard Wrap… and then Text‣Add/Remove Line Numbers? I suppose that depends on what you’re used to. When we’re done, the original selected text has been replaced with a hard-wrapped and numbered version.
Then we run Any Filter and enter the fmt command with a width option of 40 and pipe that through the nl command with the options to use a two-digit, zero-padded number and a colon separator. For reasons I don’t understand, BBEdit’s Text‣Hard Wrap… command isn’t available as a Text Factory action, so we’ll use the fmt command to do our work. Suppose I have a bunch of text I want to hard wrap to 40 characters per line and then number each line.
Because this is saved as a Text Filter, BBEdit knows to feed it the selected text (or the entire current document) and replace that text with Any Filter’s output. The final line is just the execution of that command. bash:ģ: cmd=`osascript -e 'get text returned of \Īs you can see, most of Any Filter is an AppleScript command that displays a dialog box asking for and collecting the command. It’s available to me from the Text‣Apply Text Filter submenu and I have it bound to the ⇧⌃⌥⌘F key combination. Here’s a shell script, called Any Filter, that I have saved in BBEdit’s Text Filters folder. Surprisingly, it’s not all that hard to give it that ability. If only BBEdit would let me just type out a pipeline to run the selected text through. You may wish for the ability to just type out a pipeline of commands and send the text through it.Īnd when I say “you,” of course I mean “me.” Although I’m far from a Unix wizard, I do find myself thinking of transformations in terms of command-line utilities rather than Text Factory actions. There’s often a lot of clicking needed to put together a Factory and choose the necessary options for each step. If, however, you’re used to using Unix command line tools to build up transformations, you may find the graphical method of creating Factories somewhat slow. Factories can be more of an ad hoc solution (although they also can be saved in the Text Filters folder for frequent use) and are therefore more suited than Filters are for one-off transformations.įactories are a great way for people who don’t have much experience programming or using the command line to automate BBEdit’s Text menu commands in powerful ways. They’re really most useful for transformations you intend to run often. 2įilters require a certain amount of premeditation you have to create a script and save it to a particular folder.
This is very much in the Unix tradition of command line text tools except that the current selection (or document) takes the place of standard input and standard output. The main difference between Text Factories and pipelines is that a factories are built up graphically, very much like Automator workflows.īoth Filters and Factories take the selected text (or the entire current document if no text is selected), perform the transformation, and replace the text with their output.
#BBEDIT COMMENT TEXT SERIES#
Text Factories, which are like Unix pipelines in that they allow you to create a single command that sends the text through a series of successive simple transformations. Text Filters (née Unix Filters), which run a script saved in a special Text Filters folder 1 and accessed through the Text‣Apple Text Filter submenu.In addition to the single-stage text transformations in its Text menu, BBEDit has a couple of ways to perform complex text transformations: Next post Previous post One-off text filtering in BBEditĪfter my recent appearance with David and Katie on the Mac Power Users podcast and a Twitter conversation with Eddie Smith, I’ve been thinking about text transformations in BBEdit.