The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Updated MSH Syntax Highlighting For VIM

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Peter G Provost

Posts: 849
Nickname: pprovost
Registered: Aug, 2003

Peter G Provost is a Solution Architect for Interlink Group in Denver, CO.
Updated MSH Syntax Highlighting For VIM Posted: Aug 14, 2005 10:05 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Peter G Provost.
Original Post: Updated MSH Syntax Highlighting For VIM
Feed Title: Peter Provost's Geek Noise
Feed URL: /error.aspx?aspxerrorpath=/Rss.aspx
Feed Description: Technology news, development articles, Microsoft .NET, and other stuff...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Peter G Provost
Latest Posts From Peter Provost's Geek Noise

Advertisement

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!

Here is the new msh.vim file. If you followed my previous instructions, then begin by undoing all of it.  Then download this new msh.vim file and follow Tommy's instructions:

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.

Now playing: AC/DC - Rocker

UPDATE 2005-08-12: Posted it to the vim.org scripts section.
UPDATE 2005-08-13: I made a small change to the syntax file that fixed a problem with foreach and while. The current version is 1.2. I will also be re-posting it to the vim.org scripts board.

Read: Updated MSH Syntax Highlighting For VIM

Topic: Lookahead (or -behind) assertions in regular expressions Previous Topic   Next Topic Topic: Blogging my way to the PDC - contest ending soon

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use