mapserver syntax file for gedit

Gedit is my editor of choice at the moment, but, with all it’s great plugins, it was kinda lacking when working with Mapserver map files. So far vim, textpad and notepad++ have syntax support for map files, and now I’m happy to announce, Gedit does!

gedit syntax for mapserver map files

There’s a bit of tweaking to get it working.

1. First, we need to tell gnome to associate the .map file with the syntax, by giving it it’s own mime-type (you could skip this, but then you would need to manually select the highlighting mode for each file).

Download this file: and copy it to /usr/share/mime/packages/ directory

Then, update Gnome’s mime database:

$ sudo update-mime-database /usr/share/mime

2. Next download the syntax lang file: and copy it to the /usr/share/gtksourceview-1.0/language-specs directory (or gtksourceview-2.0 if you are using Gutsy)

3. Restart gedit, open up a .map file and voila!

Thanks to the vim, notepad++ and texpad syntax files that I used to write this. Tested with Ubuntu 7.04 (Fiesty) and gedit 2.18.1 – let me know if it works, or doesn’t with Gutsy.

For Gutsy, gtksourceview2.0 .lang files have a different syntax – but it is meant to work with 1.0 version files. There’s also a conversion utility that could help.

EDITS: See comments for a way to get it working with Gutsy, thanks Michal!