Vim Folding Rules for MapServer Mapfiles
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.
Folding did not work as described here, but as described in the map_fold.vim file
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.
very useful!