When editing an HTML file, if the cursor is on an opening tag, the matching tag is highlighted in the editor. I would like to be able to map a key combination like alt+→ (or something) to go to the closing tag. I looked for an existing action like this in tools->options->keymap, but did not find one, so I decided to try to create a macro for it. I have found that I can do it in multiple steps like this: ctrl+/ (fold code), →, ctrl+* (unfold code). I recorded a macro of this, and it produced this code:
collapse-fold-tree caret-forward expand-fold-tree
Unfortunately, when I run the macro, the cursor stays in the same place, rather than ending up at the end of the closing tag like it does when I do the steps manually. I have successfully created a macro that moves from the closing tag to the opening tag with:
collapse-fold-tree expand-fold-tree
but I cannot get the forward one working. I am also having a bad feeling that I just overlooked the action in the keymap settings and am now trying to reinvent that wheel. Is this an action that is already there? And if not, does anyone know how I might get the macro to work?
You can add keyboard shortcuts to your page through HTML with the global accesskey attribute and trigger it with Alt + Shift + key in Chrome and Firefox on Windows, or use Control + Alt + key on Mac.
Editing and Refactoring Code in NetBeans To add a keyboard shortcut for a command: Choose Tools | Options and click the Keymap panel. In the Actions panel, navigate to a command that you want to change, and click Add. In the Add Shortcut dialog box, type in the key combination that you want to use and click OK.
Just click on the "Source" menu, in the menu bar, and look for the items "Move Up" and "Move Down" or "Move Code Element Up" and "Move Code Element Down". They should show the shortcut/accelerator for your platform.
There is an existing action in the keymap for this. It is called "Insertion Point to Matching Brace". The shortcut is ctrl + [ or command +[ in Mac.
There is also shortcut Ctrl + Shift + [, which selects content inside this tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With