Editors and Java Server Page Synax Highlighting 8
Nathan Frund asks: "VIM has been my mainstay for writing code/HTML/config files etc for a long time. But VIM doesn't hightlight JSP syntax. I've become accustomed to the syntax highlighting and can't go back to not having it. I've tried various modes for VIM but none of them really do the trick. XEmacs doesn't support it either (I haven't found where it does or even the resources to make it highlight jsp syntax) and I really don't have the time to become a VIM or an Emacs expert to write the modes from scratch. My question to all of you, What editor(s) are you using to write Java Server Pages? "
You might try Jedit (Score:1)
Personally I have gotten more minimalistic over time. I used to use IDEs and now I just use vi and let my mind (and compiler) do syntax verification. Sure, there are better things to clutter the mind with but it just feels good to use vi.
WebSphere Studio (Score:1)
-Tim Dyck, PC Week Labs
Never hurts to ask... (Score:1)
You might like to try subscribing to the vim mailing list ( http://www.vim.org/mail.html ) and simply ask if there's anyone else out there who would be nice enough to write the syntax file and add it to the distribution. There might even be an unofficial one out there that you just don't know about. Hey, never hurts to ask...
Multi-language highlighter (Score:1)
This is my jsp.vim (Score:1)
You'll have to figure out where to save this file yourself; but it should work in vim5.3+
" Vim syntax file
:p:h/html.vim :p:h/java.vim
" Language: JSP
" Maintainer: None
" URL: None
" Last change: 1999 November 1
" Remove any old syntax stuff hanging around
syn clear
syn case ignore
if !exists("main_syntax")
let main_syntax = 'jsp'
endif
" tags
syntax include @html
syntax include @java
syn region jobby start=+ syn region jspCode matchgroup=jspDirective start=++ contains=@java keepend
syn region jspOutput matchgroup=Special start=++ contains=@java keepend transparent
syn region jspDeclaration matchgroup=Special start=++ contains=@java keepend transparent
syn region jspDirective start=++
syn region jspComment start=++ keepend
if !exists("did_jsp_syntax_inits")
let did_jsp_syntax_inits = 1
hi link jspDirective Special
hi link jspComment Comment
endif
Re:This is my jsp.vim (Score:1)
That line in my html.vim looks like this (where it defines what is javascript):
syn region javaScript start=+]*>+ keepend end=++me=s-1 contains=@htmlJavaScript,htmlCssStyleComment,html
I'm not that familiar with the vim-syntax-syntax though...
mmm.el (Score:2)
;; Author: Gongquan Chen
;; This file implements a XEmacs lisp extension
;; that allows multiple major modes
;; to co-exist in a single buffer. It's a
;; workable, yet imperfect, solution that
;; basically supports key bindings and font-lock
;; in those regions with a secondary
;; major mode. To activate one secondary major
;; mode, simply add a hook to the
;; primary major mode's hook. For details, see
;; defun `mmm-activator'.
Unfortunately, it's pretty big to try to actually post as a comment and there's no URL in the comments of the LISP file. You'll probably have to search through something like Altavista for 'mmm.el' or search on Deja.com or just write the author and see where you can pick up a copy.
I use it myself for about a year or so with XEmacs (It requires a 21.x version to work correctly) and it works about 99% perfectly with HTML and whichever scripting language I happen to be embedding. (It actually uses a major-mode for the scripting language, so for JSP, the "primary major mode" is HTML except when your cursor is inside <java> tags in which case mmm switches to JDE mode.)
There are a few global settings, like TABs I think, that it doesn't change because the "primary major mode" sets them globally and they won't get changed when you enter the "secondary major mode" but they're really pretty minor issues. (Pardon the pun.)
The main drawback is you will have to learn a *little* bit of LISP hacking to set up the filters to let mmm know when to switch modes, but there are enough examples in the comment section of mmm.el that you can pretty much just cut-n-paste to get it to work for your particular situation.
-=-=-=-=-
Re:mmm.el (Score:2)
Gongquan Chen (chen@posc.org)
-=-=-=-=-