Coda 2 Apache Syntax Highlighting Mode

I was doing some work with .htaccess files, and some apache config files too, and found it frustrating to not have a syntax highlighting in Coda 2.

Well, i went ahead and I made one. (well, that’s a lie… I took a Coda 1 mode that I found on the internet, and made it work with Coda 2. While adding a few handy things, too.)

I think i’ll add some string support soon, and maybe I’ll end up adding some other features. In any case, I’ll have it available here:

EDIT 2: This has been tested with Coda 2.5, and has been updated! (This project is now available under the MIT license, at My Github account. Updates include those from Eric, Stan and Kevin below. Hope you all enjoy it! The previous link to will remain functional, and points to the latest zip.)

EDIT: this has been updated 2014/01/02 (Hosted on dropbox. Used the google link so I can see how many downloads its getting. I’ll consider making it better if it gets many downloads.)

Updated to add some apache keywords. (Thanks to Michael Lindahl for pointing them out )

Read more for installation instructions.

Installation instructions:

1. Move ApacheConf.mode to “~/Library/Application Support/Coda 2/Modes”

Should look similar to this

Should look similar to this

2. Sometimes the “Modes” folder will not exist yet, so you can just create it.
3. Open Coda 2. (Or restart it!)
4. In Coda 2 preferences, “cmd – , ” , go to “Editor” and “Custom Syntax Modes” at the bottom.
5. Enter “conf” and set it to use apache.            – this may already be done!
6. Enter “htaccess” and set it to use apache.    – this may already be done!
7. Installation is now complete.

Feel free to let me know of anything I missed in the comments. I’m certain I left out some vital bit of apache .conf highlighting!

You can also set Coda 2 to use “Apache” as syntax highlighting via

Text -> Syntax Mode -> “Apache”.

Example of how it looks

Example of how it looks


32 thoughts on “Coda 2 Apache Syntax Highlighting Mode

  1. Thanks for posting this. The mode isn’t showing up for me in Coda’s “Syntax Modes” menu… Any idea what might be wrong? I’ve put the .mode file into the folder you mention above, and restarted Coda.
    I’m using Coda 2.0.4 / OS X 10.7.5
    Thanks again!

    • Hi Shawn,

      It should be in Text -> Syntax Mode -> Apache.

      I’ll have a root around to see if something else could be causing an issue. I’m using 2.0.4 and 10.8.2, so there shouldn’t be an issue there.

      • Yeah, I can’t figure it out. I tried installing another .mode file as a test and that one showed up fine in the Syntax Mode menu.
        Don’t know if this will help but here’s the ‘get info’ on the mode file I installed from your zip (you can see the file’s location and permissions here, so I thought it might help):

        • Hmm, that’s very strange. I tried it in the Users/Library , like you have, and it worked fine for me.

          Is it that there is another Coda 2 window open?

          I’ve also uploaded the file again, so give the new link a try there. Maybe it’s something that went wrong that somehow made it into the zipped version!

    • Oh, great news!!

      Let me know if there are any additions I could make to it. (e.g. certain keywords I left out, or number highlighting, etc.)

      I was thinking about highlighting strings wrapped in ” ” , but I havn’t had time to actually do it!

      Glad I helped someone!

  2. Great post, thanks for sharing! I tried using each one of the Coda 2 defaults (to see if any would work) and no dice.

    One thing to note– I didn’t have to set the conf and htaccess files from the edit panel, they worked automatically!

    • Oh cool, I tried to make it automattic, but sometimes it doesn’t work. I found when I was testing, that it only worked occasionally, that’s why I added the instructions!

  3. Thanks for this! Double-clicked the .conf file in Finder, and it installed. Reopened Coda, and it applied the mode to my open .htaccess file all by itself. Very helpful – thanks!!

  4. Thank you, switched from TextMate to Coda today and it was the only feature missing. Double clicking your .mode file was all I had to do, all the other steps happened automatically. Thanks.

    • Great! So glad you found this useful, let me know if there is anything I can improve on. (I think I have most of the keywords highlighting properly now) And great news that all that was needed was a double-click! 😄

  5. Thank you very much! This make htaccess files much more readable! One thing though, I often create comments by using the keys ⌘/ but this doesn’t work in this syntax mode. Any suggestions?

  6. I’ve tried putting the mode file in both root and users’ Application Support > Coda 2 folders, installing by double-clicking (which put it in the users’ folder, not the root version as your screen capture above shows, contrary to your path in the instruction content), and I’m having no luck after several relaunches (including one triggered by the file’s dbl-click install approach) which also opened up the plugins pane of coda’s prefs but won’t show it as an available mode to enable/disable/uninstall… thoughts or suggestions?

    • @Jeremy – I had the exact same issue on OS X El Capitan. Tried manually dragging to my ~/ “Coda 2” folder – nothing, even after a Coda restart. Thought it was Apple’s xattr so did xattr -d ApacheConf.mode/ – no change. Dumped it, double-clicked the one from the latest version on GitHub. Restarted Coda several times, no Apache syntax mode. Dumped the file again, quit Coda, double-clicked the mode file again, which opened Coda and its pref pane but showed only Bash (which I’d used previously for .htaccess files). Closed the pane (yet again) and – after it took some time to actually close – the Apache mode was ‘magically’ available. Spooky action from a distance.

      • Thanks Dave, maybe I’ll try following your same process again this afternoon to see if I get the same “happy accident” of it changing behavior on its own a few tries after changes are made. a couple quits, a couple reboots, maybe it’ll trigger a change after I clean some extra caches… it’s been a while since I did my monthly duty with onyx too, so it’s about time.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s