.. _vim:

*****************************************************************************
 VIM Syntax 
*****************************************************************************

:Author:        Andreas Hirner
:Contact:       andreas.hirner at dlr.de
:Author:        Schuyler Erle
:Contact:       schuyler at tridity.org
:Revision: $Revision$
:Date: $Date$
:Last Updated: 2006/5/5

.. contents:: Table of Contents
    :depth: 2
    :backlinks: top

General remarks
===============

vi (vim) resides in: /usr/share/vim/current (vim_root).

Syntax definitions are in vim_root/syntax/\*.vim files. Linking file types to
extensions is done in vim_root/ftdetect/\*.vim. (The the star denotes the
extension and would be replaced with map to define highlighting of MapServer
config files).



Installation
============

The installation process requires two steps:

1. Copy the `map.vim`_ syntax file to the syntax directory

   Copy map.vim to the vim syntax directory (on Suse: /usr/share/vim/current/syntax)

2. Register the syntax file in the custom filetype directory

   If absent, create a new directory called ftdetect in vim_root (on Suse
   Linux: /usr/share/vim/current). Create a new file called map.vim in
   ftdetect according to the example shown below:

   ::

     " MapServer config file
     au BufNewFile,BufRead *.map         setf map

Now restart vim and open a map file ....

Folding
============

Introduction
------------

`Vim code folding <http://www.vim.org/htmldoc/usr_28.html>`__ 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
------------

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 <http://www.vim.org/htmldoc/usr_28.html>`__ (at
least the first two or three sections) is highly recommended. The Vim `folding
reference <http://www.vim.org/htmldoc/fold.html>`__ 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!
 
Closing Remarks
===============

The keywords are based on the TextPad Symbol Map_40.syn file contributed by Christopher 
Thorne, which can also be found on the MapServer utility page.  I hope the file is 
somehow useful to anybody out there. If there are any questions or suggestions, 
please feel free to contact me.

.. _`map.vim`: ../../_static/map.vim
.. _`map_fold.vim`: ../../_static/map_fold.vim