From: Steve J. <ste...@wi...> - 2003-05-27 16:01:55
|
On May 27, 2003 06:41, Christopher Granade wrote: > Is there an easy way to range comment a block from a Velocity template > using jEdit's current mode's definition without messing with what's > selected in the buffer? Thanks! If I understand you correctly, what you want is to be able to set up a template for use with the Templates plugin which will add range comments to selected text based on the current buffer mode. If so, try something like this: ---------- Template start ---------- ##template = Range Comment ## ## Determine the appropriate comment delimiters based on the buffer mode #beanshell (false) mymode = buffer.getMode().getName(); if ("java".equals(mymode)) { context.put("comment_start", "/* "); context.put("comment_end", " */"); } else if ("velocity".equals(mymode)) { context.put("comment_start", "#* "); context.put("comment_end", " *#"); } #end ${comment_start}${_jeditSelection}${comment_end} ---------- Template end ---------- This example supports Java or Velocity code. Just edit the beanshell section for other modes. Steve Jakob |