Thursday, February 27, 2014

BBEdit/TextWrangler Codeless Language Module for IDL

UPDATE April 2015: I've now updated the CLM for IDL vesion 8.4, for use with BBEdit 11.x. You can download it here.

For nearly a decade I've been using IDL, a programming language that's good for visualising lots of data. Recent versions ship with an IDE based on Eclipse, which is either horrible or great depending on whether you're an advocate of the Eclipse environment. I'm not.
Call me old fashioned, but I like to code in a simple text editor, and debug from a terminal. I work on Mac OS X, and my choice of text editor is BBEdit or TextWrangler, both from BareBones. TextWrangler is free and should be on every Mac, and BBEdit costs money but has some great additional features. I've tried to find a text editor as useful on Windows, but there just isn't one.
A few years ago I wrote a Codeless Language Module (CLM) for BBEdit (and TextWrangler), so that it can apply syntax highlighting to IDL source code. The CLM is a .plist file, which is a flavour of XML that contains keys described in BareBones' documentation that allow lots of cool stuff to happen. This includes:
  • syntax highlighting (comments, quotes, etc)
  • keyword highlighting (and predefined names)
  • autocompletion of function names
  • function scanning (makes function names apear in the function pop-up menu for easy navigation)
  • automatic recognition of language based on filename extension
  • code folding
Here's what it looks like:

The IDL Configuration.plist file is provided here for you to download. There are some comments at the top of the file about how it was generated - mainly for my own memory so I can regenerate it when a new version if IDL comes out. It refers to some custom functions I wrote to extract information from the IDL documentation and help files, and generally make life easier. If you'd like to get hold of these functions let me know.

Using CTAGS with IDL and BBEdit/TextWrangler

As an added bonus, we can also use Exuberant Ctags to scan IDL code files and generate 'tags' files. These are used by BBEdit for autocompletion. The use of ctags is well documented in the BBEdit manual, so I won't go into detail here, except to say that they're great, and I have written a routine to generate a 'tags' file for IDL codefiles, which you can download here. You also need to have the appropriate stuff in ~/.ctags for ctags to scan your *.pro files correctly. These are the lines that do the magic:
--regex-IDL=/(^[ \t]*(pro|function)[ \t$]+)([A-Z_a-z0-9:]+).*$/\3/d,definition/i
If you have any problems or suggestions, please let me know.


  1. Where should I install this file?

  2. Hi, The .plist file should be put in the Language Modules subdirectory of BBEdit/TextWrangler's Application Support folder. The path to this folder is:

    ~/Library/Application Support/BBEdit/Language Modules/

    and for TextWrangler
    ~/Library/Application Support/TextWrangler/Language Modules/

    In recent versions of Mac OS X the Library folder is hidden. You can get to it in the Finder by selecting Go->Go To Folder..., and entering ~/Library in the box that appears. The tilde symbol (~) is shorthand for the current user's home directory.

    Once the file is in the correct directory, restart BBEdit/TextWrangler and the file should load. If is doesn't it may contain an error - you can check the Console for messages in this case.

  3. The .plist worked for me, using BBEDIT13 to edit IDL code on my Mac with macOS Catalina. I see the color-coded text associated with IDL syntax. Thanks!

  4. Thank you for supporting the .plist for IDL. Been using it for years, and needed a new version for my new computer.

  5. Looks like the plist file is no longer available for download. Clicking on the download link results in a "site not found" error. I'm really curious how you got the code folding to work.