Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In NetBeans, is there a keyboard shortcut for moving between HTML tags?

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?

like image 562
Don't Panic Avatar asked Oct 08 '14 16:10

Don't Panic


People also ask

How do I use keyboard shortcuts in HTML?

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.

How do I create a shortcut key in NetBeans?

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.

How do you move a line up in NetBeans?

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.


2 Answers

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.

like image 123
dramzy Avatar answered Oct 19 '22 06:10

dramzy


There is also shortcut Ctrl + Shift + [, which selects content inside this tag.

like image 1
Jarosław Wasilewski Avatar answered Oct 19 '22 07:10

Jarosław Wasilewski