[mercury-users] Emacs mode
Ralph Becket
rwab1 at cam.sri.com
Tue May 4 19:23:27 AEST 1999
> I have only just started teaching myself Mercury (heh), and I was
> wondering if anyone out there has made an Emacs mode for it? It is
> currently loading *.m files in ObjC mode.. And I am told that gvim
> gives you Matlab syntax highlighting. (my concern is not only the
> hightlighting, though.. The indenting is rather screwy, too.)
Can't help you with Emacs (if you use it you're beyond help :o), but
with Vim you need to make a few small changes.
It's standard to finish your ~/.vimrc with something like the following:
if version >= 500
source ~/vim/syntax.vim
endif
Then copy $VIM/syntax.vim to your own directory ~/vim and edit it. In
particular, you want to comment out the line for Matlab and add
something like
au BufNewFile,BufRead *.m,*.int,*.opt so $VIM/prolog.vim
or, if you want to roll your own,
au BufNewFile,BufRead *.m,*.int,*.opt so ~/vim/mercury.vim
Here's my mercury.vim file:
=================
" Vim syntax file
" Language: Mercury
" Maintainer: Ralph Becket <rwab1 at cam.sri.com>
" Miscellaneous settings.
set tags=./tags,/home/rwab1/mercury/library-tags
set makeprg=mmake
" Remove any old syntax stuff hanging around.
syn clear
" Mercury is case sensitive.
syn case match
" Very simple highlighting for comments, clause heads and
" character codes. It respects Mercury strings and atoms.
syn keyword mercuryKeyword module use_module import_module
syn keyword mercuryKeyword include_module end_module
syn keyword mercuryKeyword interface implementation
syn keyword mercuryKeyword pred mode func type inst typeclass
syn keyword mercuryImpure impure semipure
syn match mercuryCharCode +0'.+
syn region mercuryString start=+"+ skip=+""+ end=+"+
syn region mercuryAtom start=+'+ skip=+''+ end=+'+
syn region mercuryClauseHead start=+^[a-z]+ end=+:-\|\.\s*$\|-->+ contains=mercuryComment,mercuryCComment
syn region mercuryCComment start=+/\*+ end=+\*/+
syn match mercuryComment +%.*+
syn sync maxlines=100
if !exists("did_mercury_syntax_inits")
let did_mercury_syntax_inits = 1
" The default methods for highlighting.
hi link mercuryComment Comment
hi link mercuryCComment Comment
hi link mercuryCharCode Special
hi link mercuryKeyword Keyword
hi link mercuryClauseHead Statement
hi link mercuryString String
hi link mercuryAtom Constant
endif
let b:current_syntax = "mercury"
=================
Cheers,
Ralph
--
Ralph Becket | rwab1 at cam.sri.com | http://www.cam.sri.com/people/becket.html
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list