Can't easily jump cursor to end of autoclosed tag in Eclipse

145 views Asked by At

Eclipse (Luna 4.4.2 on Win7), at least in its Structured Text Editors, has a nice feature whereby if I type a tag, it automatically inserts a matching closing tag after the cursor.

<step>(cursorhere)</step>

After typing the tag contents, how do I efficiently jump past the closing tag?

<step>my step content(cursorhere)</step>(wanttojumphere)

Rationale and attempted solutions: It seems pretty clunky to have to use Ctrl + Right-Arrow four times to get past < then / then step then > when this seems meant to save time/keystrokes. Surely there is something quick meant to go along with this feature while typing, but I could not find it in the keybindings, searching for cursor, caret, move, jump, skip, next, and tag. The closest I found was 'matching tag' which is defaulted to a three-key combo (seems like it wouldn't be the default, for something used so often), and trying it in context, does not do anything that I can see.

UPDATE: I found these three pages:

How do I skip past an automatically generated end </tag> in my IDE without lifting my hands off the keyboard (or using arrow keys)?

What is the name of the keyboard shortcut &/or method in an IDE which allows me to jump past automatically generated </endtags>?

https://youtrack.jetbrains.com/issue/IDEABKL-6984

...and still I am not finding what I'm looking for. The "end" key answer does not help in the context of nested inline tags, e.g.:

<userinput>buildtool <replaceable>/path/to/your/project</replaceable></userinput>

In this case, after typing project I want to jump the cursor to after </replaceable> to add another buildtool parameter and hitting End goes too far.

As for other answers given there, unlike Zeus and TextPad, I don't think Eclipse has such a handy macro recorder, either.

That last link is interesting in that many of the somewhat recent posts assume that Eclipse has this functionality by pressing Tab. However, on my fresh Eclipse install, pressing Tab in this context simply inserts a Tab character. I can even see

the visual clue - a marker where Tab "jumps" to if pressed. This is also important part of this feature. It serves two (maybe more) purposes: a) indication that this mode is on and b) highlights a next cursor position if Tab is pressed.

...mentioned here, but pressing Tab does not jump to it, as I said. In fact, I'm pretty sure the marker I'm seeing is the bracket matching marker, because just after finishing an opening tag, the marker is at the initial < I typed; typing anything further then moves the marker to the > of the autogenerated closing tag.

1

There are 1 answers

0
Kev On BEST ANSWER

It's called "Matching Character" (When "Editing in Structured Text Editors) and its default keybinding is Ctrl+Shift+P. As soon as you type a character inside the tag you just made, this will jump to just past the closing tag. (If you want an empty tag, just hit the right arrow key first.)

Unfortunately, remapping it to Tab means that you lose Tab's normally functionality of making indents, when you're not in a context where there's a character to match.