Making the perfect AS editor
Part 1: “Test Movie”

placeLogo(‘jedit’); I recently promised to set up a section dedicated to customizing jEdit for use as an all-purpose ActionScript editor on the Mac. As soon as I started compiling information, viagra though, I realized I’d set myself up for a herculean task of documenting. Thus, I’ve decided to dish out the advice in small parts as I write it, rather than waiting forever to publish one ridiculously long — and ridiculously late — update. This is the first of what will become a series of articles with the goal of creating the “perfect” OS X (and indeed, totally cross-platform) programmer’s editor, using jEdit as its base.

I am quickly becoming a big fan of jEdit, a Java-based editor I’d repeatedly (and perhaps unfairly) dismissed in the past. The fact is, there is a huge shortage of good ActionScript editors available for my chosen platform (OS X), and the more I use the popular commercial options, the more I realize I don’t want to work “Mac-like;” I want to work the same way I work when I’m not using my own computer at home. With a little work, and a whole lot of customizing (through macros, plugins and other magic), I really think jEdit can meet my needs on any platform now.

Finding the tools

First order of business: If you haven’t already, download the latest development version (4.3pre10) of the jEdit Mac OS X package from (Don’t worry about the “development” vs. “stable” bit… The development version has been in the works for years, and yes, it’s stable now. These guys are careful). Install it (I won’t bother telling you how; they’ve got instructions if you need them), and launch it.

I’ll go ahead and warn you: At first glance, jEdit isn’t exactly beautiful. It’s a cross-platform editor, and therefore some of the interface design is not exactly what one might expect from a mature Mac application. But don’t worry, over the course of this series, we’re going to change that!

To begin our long journey from ugly duckling to ActionScript swan, we’ll need a few readily available plugins. Installing them is simple: Under the Plugins menu, choose Plugin Manager… and make sure you see the following items in the list: Console, Project Viewer, Sidekick, CtagsSidekick. If you don’t see them (and you probably won’t see all of ’em), no problem: Just click the “Install” tab in the dialog box, wait for the ever-growing list of free plugins to appear, and select and install each of them. We’ll come back for more later, but for now, this should get us started.

Out of the box, jEdit comes with full syntax-highlighting support for ActionScript 2. That’s nice, but it’s not enough. Fortunately, we can thank Jesus Gollonet for creating an ActionScript 3 edit mode for jEdit just last month. Download the file from his site, and save it in your ~/.jedit/modes folder (If you don’t know what that means, read on to discover just where to find this file).

A little housekeeping beforehand

Ok, to fully customize jEdit to our tastes, we’re going to get our hands a little dirty with some old-school shell scripting (fortunately, jEdit is great at doing this, too). To keep everything together, I prefer to save my extra files in a subdirectory of the same folder in which jEdit keeps its settings. Unfortunately, the jEdit settings are (by design) inside a hidden folder (specifically, ~/.jedit), so unless you’ve already got your system set up to expose hidden directories, we’re going to have to take a few steps to get there (It’s never easy, is it?).

The .jedit folder is located in your home directory (which itself is abbreviated as “~” in *nix-based systems and indicated by the house-shaped icon in the OS X finder), but it’s usually not available to the casual user. It’s easy enough to get to in a number of ways, though (Hint, read to the bottom of the following list for the “easy” way):

  1. Go through the normal convoluted processes to show all hidden files, as discussed here (Not recommended)
  2. Open a Terminal window and enter open ~/.jedit to get there through a command line. (Nerd sexy, but not necessary), or…
  3. Use the Finder’s little known Go>Go to Folder menu command (or hit Shift-CMD-G) and type ~/.jedit as shown:
Go to Folder

Regardless of how you get there, once there, you might as well make it easy on yourself next time (you’ll be spending a lot of time here until you get everything set up just right) by making a visible shortcut. To do this, drag the small icon from the top of the folder’s finder window to wherever you want the shortcut (I suggest the Finder’s sidebar for quick access from anywhere).

Drag shortcut to sidebar

Note: On Windows, I think the equivalent directory to ~/.jedit is C:\Program Files\jEdit, but I won’t swear to it.

Ok, now we at last want to create our own ~/.jedit/launchers subfolder in which to place the shell scripts and other support files we’re going to make later. I called my folder “launchers,” and to make things easy, you might as well too.

Ok, let’s do something with Flash today

Now that this bit of housekeeping is out of the way, let’s make jEdit do something Flash-y. For starters, how about making the familiar CMD-ENTER key combination test the current movie in Flash? Sure, we could do this in a traditional Mac manner using AppleScript or Automator, but we’re Switchers, aren’t we? So let’s keep it cross-platform and do it the old fashioned way (mainly because this is the way I did it the first time).

To do this, we’ll need to create a Flash JSFL file that simply tells the Flash IDE to “Test Movie.” Then, we’ll create a jEdit macro to execute this command at will. Finally, we’ll want to assign this new macro to our old friend, CMD-ENTER (or F6 for you FlashDevelop veterans).

This is simple enough: In your favorite editor (I suggest jEdit), save the following line in a new file named flashtest.jsfl and save it in your new launchers subfolder (Good news! if you can’t find your hidden .jedit folder in the jEdit Save File dialog box, simply right click inside the dialog box and select “Show Hidden files.” They thought of everything):


Source code for ~/.jedit/launchers/flashtest.jsfl

Ok, so that’s the file that lets Flash know what to do. But now we need to let jEdit know how to launch that file. In other words, we need a macro to launch flashtest.jsfl from jEdit. Easy enough! Save the following file in ~/.jedit/macros/Test_in_Flash.bsh:

// Save this file to your hidden ~/.jedit directory
// as "Test_in_Flash.bsh"
// This will cause the command to appear under the
// Macros directory as "Test in Flash." You can
// then assign a Shortcut key (such as CMD-ENTER
// or F6) using jEdit>Preferences>Shortcuts>Macros.
// Note: In order to use this macro, you'll need jEdit's
// "Console" plugin installed
runCommandInConsole(view,"System","open ~/.jedit/launchers/flashtest.jsfl");

Source code for ~/.jedit/macros/Test_in_Flash.bsh

Ok, so that actually provides the mechanism by which jEdit can tell Flash to “Test Movie.” Once you’ve saved this file, you can see the new Test in Flash item under jEdit’s Macros menu, and you can use jEdit>Preferences>Shortcuts>Macros>Test in Flash to assign the CMD-ENTER and/or F6 keys to the macro itself. Tada!

Go ahead and try it!

Not so fast there…

So did it work? Or did it just launch Flash and do nothing? Note that you will still need to have the relevant FLA file open in Flash before running this macro, so Flash will know which FLA needs its attention (This is common to any text editor, I believe).

I guess we might as well teach jEdit to open FLA files in Flash for us, too. Stay tuned for the next update!


14 thoughts on “Making the perfect AS editor
Part 1: “Test Movie””

  1. Thank you soooo much, thats uberkind! I’ll give your instructions a try riiiight away.

  2. Hi, nice work. I’m looking forward to seeing if you have any success with the SideKick plugin. So far, I haven’t found any AS3 parsers for it and I unfortunately don’t have time to start doing one myself right now 🙁

    In case anyone is interested, I have written in my blog about a couple of macros I use to compile my Flex apps (+ a shell script I use to run the compiler and display Growl notifications):

  3. Thanks for the great links, Ali. The more helpful hints we can get in this series, the better. And yes, the Sidekick plugin is the “doozy” of this project, but I’m tired of waiting for code completion on the Mac.

    Fortunately, I’ve got some extra time this week, so I’m brushing off my Java skills as quickly as possible. Stay tuned.

  4. btw, I’ve done it in windows and the macro must be slightly different. instead of
    runCommandInConsole(view,”System”,”open ~/.jedit/launchers/flashtest.jsfl”);
    it must be:


  5. Very interesting. I’d love to test this out, but every time I try to download plugins it fails to find any. I tried all the mirrors. Maybe I got a bad build?

  6. Geoff, funny you should mention that. Check the new post today, which goes into detail about plugin installation (and the troubles you’re likely to run into). In short, you probably need to change your download settings.
    Hmmm… Actually, now that I re-read your comment, I’m not so sure that’s the trouble. In a pinch, you can usually download the plugins (as JAR files) the old-fashioned browse-and-click way from the site. Once you have them, place the *.jar files in your ~/.jedit/jars directory, and they should work (although this may require that you restart jEdit; to be honest, I’m not sure).

  7. Hi, I was pleased to come across your various articles on JEdit.

    I have been a long time fan and plan to blog about customising it to make it look nicer too! I agree with you that initial looks is ugly and so I struggle to get my colleagues to accept it 🙂 My angle is from the web developer perspective. Will let you know when I finally get to blog about it!

    By the way, you mentioned that
    “Note: On Windows, I think the equivalent directory to ~/.jedit is C:\\Program Files\\jEdit, but I won’t swear to it.”

    It is typically “C:\\Documents and Settings\\{username}\\.jedit”

  8. oh happy days. OK, so its not Aqua friendly (looking at the ‘Open…’ dialog I thought ‘they’re ‘avin a larf’) but I can now actually code in actionscript. Thanks for your efforts and info so far.

  9. Thanks, Geraint! True, the file dialogs are a little “cross platform” for my tastes, too, but don’t let their crude looks fool you: They’re actually amazingly well thought-out! For example, the “favorites” menu is a great place to store hidden directories (e.g., “~/.jedit”), and once you use the FTP/SFTP plugin, it’s incredibly snazzy to see the Open dialog work with remote sites in the same way it does with local files.

    Still, the looks could be made a little better. If you haven’t already, check out this article and the other articles in this series to make the rest of the app a little bit more “Mac-like.”

  10. Hello !

    Autocompletion doesn’t work ? have you seen into the shortcut general option panel on “Complete word” ? This is a simple completion but very usefull.

    On my blog I have wrote (in french) some tickets about JEdit and ActionScript to build swf with Ant module and Open-source tools (mtasc, swfmill, flex2sdk) 😉

  11. I realize this article is old, but on the current build of jEdit (4.3pre18) on Mac OS 10.6 (Snow Leopard), the .jedit directory is no longer in ~, but has been moved to ~/Library/jEdit. I performed the tutorial above and it worked correctly using the new location (make sure you update the macro’s open command to point to the new folder).

Leave a Reply

Your email address will not be published. Required fields are marked *