I'd like to write a macro to be bound to the enter key, to do something like:
* If the current line contains the token 'def' (at beginning of line or with leading whitespace)
** Insert two newlines and 'end' followed by a newline (with 'end' aligned with 'def')
** Put the insertion point on the inserted blank line, and insert spaces to align with 'def' and then insert 4 more spaces
* If the current line does not contain the token 'def'
** Insert a newline
I think you can see where I'm going with this. I'm trying to make UE support Ruby as well as jEdit can. In jEdit, with the Ruby plug-in, if I type:
I get
with the cursor positioned at the underscore. If the answer is RTFM, please point me at the right section of the FM, because I can't find the macro capabilities documented anywhere!
* If the current line contains the token 'def' (at beginning of line or with leading whitespace)
** Insert two newlines and 'end' followed by a newline (with 'end' aligned with 'def')
** Put the insertion point on the inserted blank line, and insert spaces to align with 'def' and then insert 4 more spaces
* If the current line does not contain the token 'def'
** Insert a newline
I think you can see where I'm going with this. I'm trying to make UE support Ruby as well as jEdit can. In jEdit, with the Ruby plug-in, if I type:
Code: Select all
def foo[enter]
Code: Select all
def foo[enter]
_
end