Attached is a Language Module plist for use in BBEdit.
Here's the background: BBEdit (http://www.barebones.com/products/bbedit/) is one of the premiere programming-oriented text editors for the Mac with lots of great features -- including the ability to identify the functions in a code file, collapse and expand those function blocks, and color-code the keywords (e.g. built-in operation and function names). The catch is that BBEdit needs a Language Module file to do this for any particular language. I was not able to find any for Igor's programming language, so I made one and thought that others who use both Igor and BBEdit might appreciate it.
To install, quit BBEdit if it is running put the file in Library/Application Support/BBEdit/Language Modules/ and then relaunch BBEdit. You may have to create the 'Language Modules' folder. Once installed you should find 'Igor Pro' included as one of the languages recognized by BBEdit. You should also go to the "Languages" preferences to provide the .ipf suffix mapping, to set '//' for the start of comments, and to set the colors you want to use in the color coding.
Let me know if you find this useful or if you have any suggestions for improvements.
Thanks! My test shows, this also works with TextWrangler.
It seems however not to detect a Static Function. Also, how can #pragma and # include lines be colored?
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
Glad to hear it works with TextWrangler also.
I have attached an updated version (1.01) that detects Static Functions. It will now also color pragma and include as keywords (although it won't color the # in front of them).
I encourage you to open the file and take a look if you haven't already.
The coloring is just based on a long list of keywords taken from the pdf version of the manual. Perhaps someone on this list might know how to get the #'s properly coded so that they can be colored also.
The detection of the Functions is handle by a regular expression that could be tweaked further if needed.
Hope that helps.
Just an epsilon incremental improvement. I corrected a typo static was written staic....
and added a line which makes the strings to be colored. To be honest just copied from an example from BBedit (C++ codeless..) it appears to work. Attached is the modified version. Enjoy!
I was using this .plist with TextWrangler, but the shortcut menu at the top wasn't recognizing my functions, macros, or windows in the Igor procedure file. After much trial-and-error today, I've made some edits to the "Function Pattern" in the .plist, and I've attached it to this post.
What still isn't working, but would be really nice to have working, would be for TextWrangler to recognize to the end of the functions. If we can get this to work, then we can easily "code fold" the entire function. The attached .plist will fold any comments and empty lines between the function name and the first command in the function, but nothing more. If anyone else has code folding working in TextWrangler on .ipf files, please share!
I played around some more with the .plist. It turns out that b_farago's file should have worked, but because I add comments to the line after the 'End' command for functions, it wasn't recognizing these functions properly.
I am attaching the updated .plist, which now recognizes Macro and Window in addition to Function and recognizes that these extend until the End or EndMacro command (with or without comments on the same line). This allows code folding for the entire function/macro.
In addition, I've learned that in order to get other code folding features (for if statements, for instance) for .ipf files in TextWrangler (and presumably BBEdit as well), we need to make a "Compiled Language Module" rather than the "Codeless Language Module" that this .plist is. I might explore this route in my free time, but if anyone has done this and would like to share, even for a different programming language that I could use as an example, that would be most appreciated.
This is great stuff - just installed it (for anyone else attempting this, I created a new folder /Library/Application Support/TextWrangler/Language Modules/ and put the .plist file in there). Then restart TextWrangler and away you go!
I like the colour of the comments in this scheme being light grey by default - having comments in bright red like they are in Igor draws my eye away from the actual code.
DisplayHelpTopic "Syntax Coloring"
does anyone know if this works in textmate?
Probably not. But try this attachment instead. I created it years ago and haven't touched it since, but it works for me.
It works great! Thanks!
I just tried this on TextWrangler v4.5.9 and it worked great. Thanks for this!
Back to top