views:

61

answers:

1

I love short if statements without braces (PHP) like

if ($x === $y)
  echo $z;

If I want to add a few lines (maybe just temporary for debugging) I have to manually add the braces. Is there a plugin for netbeans that does that via shortcut, something like "toggle (add/remove) previous statement braces"?

A: 

The best solution I got for now are two macros

Add Curly-Braces:

caret-end-line caret-begin-line "{" insert-break

Remove Curly-Braces:

caret-up caret-end-line remove-word-next selection-match-brace cut-to-clipboard remove-line remove-word-previous insert-break paste-from-clipboard caret-up caret-end-line

Cursor position has to be in the line of code I want to add/remove braces.

sod