Following Notepad++ syntax highlighting support for .mapfiles?, does anyone know a way to automatic indent MAP files? I use VIM but so far I haven't found a way to do this on MAP files. I have found for other file formats, such as JS and HTML, but they don't work with MAP files.


Looks like there's no current indent implementation for map files so you'll most likely have to write your own. However, if you're not already aware mapserver.org provides both syntax coloring and folding vim plugins.

The files were written a while ago, so you may need to tweak it or find a newer one.

To install:

mkdir ~/.vim/syntax/
cd ~/.vim/syntax
wget http://mapserver.org/_static/map.vim
mkdir ~/.vim/fold/
cd ~/.vim/fold
wget http://mapserver.org/_static/map_fold.vim

Then you should edit your .vimrc file to include the following:

syntax enable
au BufRead,BufNewFile *.map filetype=map
autocmd BufRead *.map source ~/.vim/fold/map_fold.vim
  • 1
    awesome, thanks a lot for that, I surely need to tweak it a bit, I just opened a MAP file and got Error detected while processing BufRead Auto commands for "*.map": E475: Invalid argument: =map, but it looks great so far, any idea about that error message? – Gery Jun 1 '15 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.