Personal tools
You are here: Home Documentation How-tos Vim Folding Rules for MapServer Mapfiles

Vim Folding Rules for MapServer Mapfiles

Document Actions
Make mapfiles easier to work with in Vim, by folding LAYER, CLASS, STYLE, etc. sections out of the way when you're not editing them.

Introduction

Vim code folding can be an extremely handy way to simplify the task of editing complex MapServer mapfiles inside the Vim editor. A Vim command file called map_fold.vim is attached to this document, which defines a folding mode for mapfiles. This file also lives at http://iconocla.st/code/dot/map_fold.vim.

Installation

Global installation of new Vim filetypes is described in the Vim syntax howto. In Vim 6, you can copy map_fold.vim as-is to your $VIMROOT/ftplugin/ directory, and it should more or less work.

To use locally, create a ~/.vim/ftplugin directory, copy map_fold.vim to it, and then add the following to your ~/.vimrc:

autocmd BufRead *.map set filetype=map

map_fold.vim is totally compatible with the map.vim syntax highlighter, and their combined use is even recommended.

Use

The Vim folding tutorial (at least the first two or three sections) is highly recommended. The Vim folding reference may also be helpful.

Conclusion

Hope this helps! Please let me know if you find it useful, or if you find ways to improve it. Thanks!

This How-to applies to: Any version.

by Schuyler Erle last modified 2006-05-05 17:36

very useful!

Posted by Tom Kralidis at 2006-10-05 10:39
Thanks for this. This is very useful. I've added also FEATURE and GRID to line 21 of this file. You can also add MAP if you'd like this power at the topmost level of the mapfile.

Folding did not work as described here, but as described in the map_fold.vim file

Posted by Dirk Tilger at 2007-02-01 04:02
It didn't work for me as described here. Instead I had to do an additional thing that was described in the map_fold.vim file: I had to get...

autocmd BufRead *.map source /usr/share/vim/vim62/ftplugin/map_fold.vim

... somehow into my configuration. As I installed the folding files into the $vim_root directory, I edited the /usr/share/vim/vim62/ftdetect/map.vim file to contain the line above additionally.

Powered by Plone