Integrate Firefox with your text editor

I use Firefox as my main Web browser because I am totally hooked on its extensibility. It may not be the greatest browser in the whole, entire universe straight out of the box (though it’s a damn good one), but once you’ve tricked it out with extensions and Greasemonkey scripts specific to what you use your browser for, nothing else will do. I simply can’t use Safari or Opera, no matter how many people tell me it’s faster or better integrated with other Mac applications or better at rendering certain websites, because . . . where’s the Greasemonkey? How am I going to add Convo and GMail Manager and save my browsing sessions and, and, I can’t even describe to you what modifications I’ve got on this application, because I don’t ever think about them unless I have to use someone else’s computer, and then that person’s browser—even if it’s Firefox, too, but without the exact same array of extensions and preference settings—is just broken.

But there is one thing that’s been driving me up the !@#$% wall with Firefox, and I’ve never managed to troubleshoot it away: sometimes (not always!) when I’m typing in a text area, what’s on the screen gets out of sync with my mouse, and though I can type as much as I want, when I go back to edit, I can’t ever seem to get the cursor where I want it. It’s something about fonts, I’m sure, and probably Mac-specific, but I know I’m not the only person who has this problem. I usually struggle with it using a lot of “undo” if I’m writing a short post or comment, but for anything longer, I have to select all and copy the text into some application that renders the text correctly—Eudora, if I’m not going to be typing in a lot of markup, or BBEdit, if I’m doing more demanding HTML. It’s an annoyance. I’ve been working around it for many months.

At my new job, meanwhile, I have to work in what appears to be a one-off content management system, which I’m guessing is optimized for Internet Explorer for Windows, even though most of my colleagues seem to use Firefox on Windows at work and have Macs at home. The interface is more primitive than probably any blogging platform you can think of, built by people who don’t have to use it. Character entities that you type in as escaped code (— for —) get displayed as the character itself when you hit “save.” If you re-edit and save again, they become garbage characters. Text that was typed in by a PC user breaks when a Mac user edits it. Some of the most heavily used text areas are uncomfortably small.

For these reasons and more, I have been editing all my text for the website in TextWrangler. (I do still intend to get a more full-featured program, but I haven’t felt a burning need yet.) I select everything in the CMS’s nasty text box, copy it into a new document, search-and-replace all the unescaped special characters with proper code, do all my editing, and then paste it back into the CMS and hit “save.” If I need to make further edits, I make them to my TextWrangler version and paste the whole thing in again. It’s a pain.

So imagine my delight when yesterday Lifehacker pointed out a extension that automates this round-tripping between Firefox and a text editor. It’s All Text! by The Doctor What places a faint little blue “edit” button at the lower right-hand corner of every text area, and if you click it, it opens the contents of that box in the application of your choice. (This extension is for Mac OS X only, I believe; maybe Linux.)

It's All Text! Firefox extension: edit button

It’s all Text! gives the file a gobbledygook name and stores it deep in your Firefox application support folder.

It's All Text! Firefox extension: text exported to BBEdit

This also means you have a backup in case—as has happened to every blogger at least a hundred times, I’m sure—your browser crashes the moment you’ve put the final edits on your most brilliant post ever.

When you’re done editing, you hit “save” in your text editor, and within a few seconds the text refreshes in your browser window. The form box flashes yellow and then fades back to white, to let you know that the view has been updated.

It's All Text! Firefox extension: refreshed text

It’s brilliant. It makes my life so much happier.

The only tricksy thing you need to note is that this extension speaks Unix. When you go into the extension’s preferences (Tools > Add-ons) to specify your favorite text editor, the file browser starts looking in usr/bin for a reason. Unless your favorite editor happens to be emacs or vi (and maybe it is; I’m not that hardcore, myself), you’ll need to dig around a little to locate the magic path. If your chosen editor is TextWrangler or BBEdit, going into the editor’s preferences and enabling the command line tool (e.g., BBEdit >Preferences > Tools >Install command line tool) will make it show up in usr/bin.

It's All Text! Firefox extension: preparing BBEdit

If you’re using another program, the following comment from user Marc on the extension’s home page explains how to find the right path (I haven’t tried this yet):

First, in the Finder, click with right mouse button on Application icon, choose “Show Package Contents”, then navigate through Contents to MacOS. Second, in the preference of this add-on, click on the browse button and then drag&drop the executable within the folder MacOS from before into this “Choose your Editor” window. Third, in the drop-down menu of the “Choose your Editor” go up one level to “Contents” and then navigate to the executable in the “MacOS” folder. Finally, you have chosen your editor! This might look like “/Applications/Smultron.app/Contents/MacOS/Smultron”. If the developer would just make the “Editor” field manually editable we could just add the paths ourself or copy&paste paths from the Terminal.app.

Note also, if you try to use this extension before going into preferences and selecting an editor, a modal sheet (which, as you already know, I dislike) will pop up asking you to choose your editor. There is no “save” or “cancel” button on this dialog, nor—because it’s a sheet—any red “close” button like you see here:

It's All Text! Firefox extension: preferences

Do not freak out and quit Firefox. I found that hitting “Escape” closed the window and saved my settings. Hey, the extension’s only at version 0.3.3, and you get what you pay for. But for that price, I think it’s textcellent.

14 Responses

  1. India Amos
    India Amos February 24, 2007 at 11:03 pm |

    Thanks, Chris—I know, I know! I did read that article when it came out, and I watched the comments eagerly for a while, hoping someone would offer a fix, in that way that commenters often do. You know, the “God, Jeffrey, you’re such a tool! Everybody knows you can fix this by installing the Grkzt extension. Duh!” I lost interest after, oh, maybe fifty comments, though. On reviewing the thread now, it looks like the consensus is, “Yes, it’s really busted, but maybe it’ll be fixed in 3.0.”

  2. Rose
    Rose February 25, 2007 at 7:12 pm |

    Wow, this totally happens to me when I’m using Macs and Firefox at some of my freelance jobs. Glad to know it’s not just me. (I didn’t really think it was just me, but still. You know.)

    I probably can’t use this fix, as I don’t have a lot of leeway to install all my own preferences and whatnot. But good to know it exists.

  3. Bridget
    Bridget February 26, 2007 at 8:46 am |

    I have not tried it, but couldn’t you install Portable Firefox and your favorite extensions to a flash driveand run all of the good stuff off that? This might help Rose at her freelance jobs but would require some experimentation.

  4. India Amos
    India Amos February 26, 2007 at 12:40 pm |

    I just installed this extension at work, where I currently use TextWrangler for coding, and hit two snags.

    1. Merely activating the command-line tool did not do the trick of making TW visible to this extension’s prefs window. So I did have to use that workaround from Marc, quoted above.

    2. Now that it’s set up, the plug-in doesn’t seem to work properly. It opens a TW window, but grayed out, and without the text area contents open in a new doc. Bummer. Will poke at it some more.

  5. Christina
    Christina February 26, 2007 at 1:02 pm |

    Thanks for the Convo love! For what it’s worth, I’ve had several requests for an Opera version, and it’s on the list, but it’s going to be a while before I have time for it. (#@$%ing Blogger and WordPress keep changing their comment systems, so I have to keep up.)

  6. India Amos
    India Amos February 26, 2007 at 1:31 pm |

    Hi, Christina! Convo is great. I’m a much better netizen since I installed it, actually participating in conversations (as the name suggests) rather than just leaving comments and then never following up.

    Meanwhile, I’ve got It’s All Text! working with TextMate now, no problem. No clue what’s the problem with it launching TextWrangler, but I’ll resume poking at it when I’m less busy.

  7. India Amos
    India Amos April 4, 2007 at 10:24 am |

    Update: The reason I had trouble hooking It’s All Text! to TextWrangler was that I had set IAT! to open “twdiff,” whereas the Unix name for TextWrangler is, counterintuitively, “edit.”

    Before I figured that out, I tried using IAT! with TextMate, to aid in my deciding whether I like that app, but it did not work with “no problem.” IAT! would open a new instance of the application every time I clicked the “edit” button, and then because I’m using the trial version of TextMate, it kept getting snarled on the nag screen.

    I’ve been using IAT! with TextWrangler ever since, and now the only problem is that if I make edits, save in TextWrangler, and then click “save” in our crappy CMS so I can preview the page in its proper template, if I need to reedit the page, IAT! loses track of the original exported file and creates a new one. So I have to copy my edited text from one TW window to another, to avoid having to rereplace all those stupid character entities again. I assume this is because of something our CMS does—tacking on parameters to the URL of the page when you hit “save,” most likely.

  8. asnierois
    asnierois June 16, 2007 at 3:28 pm |

    Thanks a lot : it’s the explanation I needed. In French (with diacritics characters) sometime do you have to set iso-8859-1 in the character set field of this extension’s preferences.

  9. Marc
    Marc July 23, 2009 at 8:15 pm |

    Thanks India, your comment about TextWrangler helped me solve my own problem with BBEdit; for BBEdit the path to use is: /Applications/BBEdit.app/Contents/MacOS/bbedit_tool

  10. Carlo
    Carlo July 26, 2009 at 1:30 pm |

    That’s a fantastic Firefox plugin, thanks for writing about it.

    If you’re the sort of person who likes Greasemonkey for Firefox then at heart you may be a vi person. You might want to check out vim, which has a nice GUI and other cool things.

    C.

  11. India
    India July 28, 2009 at 1:09 pm |

    Thanks for commenting. It’s funny that this post, now almost two and a half years old, is still one of the most popular on this site. You’d think such a technical post would quickly become obsolete, but although the original Firefox bug I complained about disappeared many, many updates ago, I still use It’s All Text! all the time, especially when I’m blogging.

  12. Flimm
    Flimm October 8, 2009 at 5:20 pm |

    Opera does support greasemonkey scripts, they call them “userscripts”.

Leave a Reply

%d bloggers like this: