Intellij Java/Scala: Delete to delimiter? (like Emacs Paredit) -
Intellij Java/Scala: Delete to delimiter? (like Emacs Paredit) -
one of awesome features of emacs "paredit" mode works lisp-like other languages java/scala ability nail ctrl-k (kill), , smartly delete text until appropriate delimiter, closing quote-mark, or closing brace/paren/square-bracket. delete things while still keeping code syntactically valid, i.e. delete right number of closing parens/braces, etc.
is there such action or keyboard shortcut in intellij idea? or how define macro this?
i have solution works: record macro sequence (mac key-bindings):
expand selection (alt up) expand selection (alt up) right selection (shift rightarrow) cut selection (cmd x)then bind macro ctrl-k. works great, e.g. (the vertical bar caret position when invoked):
list( "first", "second", "third |string", "fourth") => list( "first", "second", "third ", "fourth") {100, 200, {300|, 400, 500}, 20} => {100, 200, {300}, 20}
the case doesn't quite work way want when utilize parentheses:
(1, 2, (3, |4, 5), 6, 7, 8) => (1, 2, (3, , 6, 7, 8)
notice deletes enclosing right-parenthesis, because expand-selection includes enclosing parentheses. if enclosing look string or has braces, expand-selection not include right-hand-side quotes or brace.
if knew how expand-selection without including enclosing parentheses, perfect, can live have now.
java scala emacs intellij-idea paredit
Comments
Post a Comment