Anyone who has ever worked with us on coding projects will know that we love Panic’s Coda code editor, it is simply the best tool for coding on the Mac platform. Another thing we like about Coda is that, if it doesn’t do some function that you need it to, you can easily extend the functionality by developing extensions or plugins.
We have several Coda plugins that we use regularly internally that we may release in the future. As we release plugins you’ll find them on this page!
One aspect of coding that we preach to anyone we work with is commenting, we believe that code should be properly commented. One way of commenting that we like is to create a “comment banner” at the top of of each “section” of code, and especially at the very top of each file. There are many different techniques used for commenting, and each have their own opinion as to the correct way to do that, but we believe that you will find this plugin useful!
The comment banner plugin will handle comments properly for the following types of files:
- Action Script
It will also create a fully enclosed banner, handles multi-line comment banners, and it will maintain indention levels!
- Creates banners from multiple lines of text
- Fully encloses the banner, making a “box” around it
- Maintains indention levels based on the first line of your comment. If the first line of your comment, or the only line for single line comments, has two tabs at the beginning… or three spaces… whatever, it will replicate that to the other lines of your comment so that you don’t have to manually indent it after. Don’t worry, if all of your lines are indented, the plugin is smart enough to take that into account as well!
- Can be initiated on blank lines, the banner box will be created and your cursor placed inside of the box ready to type your comment/text
- Creates a “bookmark” with each comment! The first line of the each comment will be flagged as a bookmark so that it appears in the code navigator drop down!
How to Use It
Using the plugin is easy. Use one of these methods:
1. On a blank line, press shift+control+B or choose “Comment Banner” from the Plugins menu at the top. This will create a banner and place your cursor inside of the banner block ready to type.
2. Type in your banner text, the text can be multi-line and can also be indented (spaces, tabs, mixture, etc.). Highlight the text and then press shift+control+B or choose “Comment Banner” from the Plugins menu at the top.
There are several plugins available that deal with controlling whitespace inside of a document, there is even an option built directly into Coda that allows the removing of trailing whitespace, but we couldn’t find one to do it the way that we needed them to. So we wrote our own!
It will do the following:
- Strip white space on the ending of lines
- Strip white space on the beginning of a line
- Strip both beginning and ending white space
- Compress / strip all whitespace from a file
- Convert multiple line breaks into a single line break (have someone who likes to put
- 5 blank lines between functions, this will convert it to one blank line)
The above functions can be applied either to the entire file or only the selection. Typically this would be handled by one menu item or shortcut key, but we purposely split this into two different submenus and different shortcut keys for the expressed purpose of being able to fully control the output and the insertion point of the data.