After posting my VIM MSH syntax file on the internal Monad discussion list, I got a great reply from Tommy Williams who obviously knows more about how to tweak VIM than I do. Tommy showed me the right way to add a custom syntax file to your VIM setup without potentially screwing up your upgradability. He also added support for comments, which in itself is worth the update. Thanks Tommy!
The best explanation I can find for it in the help files is with :help runtimepath. That shows you the directories and files.
In this case, there are two directories and three files involved:
$VIM\vimfiles\filetype.vim
$VIM\vimfiles\ftplugin\msh.vim
$VIM\vimfiles\syntax\msh.vim
Msh.vim is the file you supplied as monad.vim.
filetype.vim
For me, this is just a series of blocks of the form:
augroup filetypedetect
au BufNewFile,BufRead *.<extension> setf <extension>
augroup END
In the case of MSH:
augroup filetypedetect
au BufNewFile,BufRead, *.msh setf msh
augroup END
ftplugin\msh.vim
This is a file where I set things like indenting, textwidth, etc. for that filetype: things you can’t – or shouldn’t – do in a syntax file. So far it’s just a shell. I’ll tweak it to add more options later, but it should give you a feel for things:
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin") | finish | endif
" Don't load another plug-in for this buffer
let b:did_ftplugin = 1
setlocal tw=0
"setlocal comments=#
setlocal commentstring=#%s
setlocal formatoptions=tcqro
"setlocal iskeyword+=#
" Change the browse dialog on Win32 to show mainly MSH-related files
if has("gui_win32")
let b:browsefilter = "MSH Files (*.msh)\t*.msh\n" .
\ "All Files (*.*)\t*.*\n"
endif
"-------------------------------
" Undo the stuff we changed.
let b:undo_ftplugin = "setlocal tw< cms< fo<" .
\ " | unlet! b:browsefilter"
" vim: ts=4:tw=0
And, of course, the syntax\msh.vim file is the one you made.