Intellij does this thing where if you type a open curly brace and then a return it inserts a matching closing brace and puts point
on a empty line between the braces and indents the two newlines. So if before you had:


 pubic void function () {
                                  ^
You now have:

pubic void function () {
}^


Simple but handy.

(define-key jde-mode-map [return]
 (lambda ()
   (interactive)
   (if (save-excursion
         (backward-char)
         (not (looking-at "{}?$")))
       (newline-and-indent)
     ;; else
     (newline-and-indent)
     (newline-and-indent)
     (when (not (looking-at "}"))
       (insert "}")
       (c-indent-command)
       )
     (previous-line)
     (c-indent-command)
     )))


Suraj


PS: The above is slightly more complicated than needs be because I use Erik Hilsdale's balanced.el which, among other things, automatically
inserts matching close parenthese when you type any kind of open parentheses.





Reply via email to