Smoothen HTML and XML editing in IntelliJ IDEA

Egor Malyshev

When you open a tag, IntelliJ IDEA assists you by automatically inserting the closing tag. This is really handy and helps avoid certain errors, but when you are typing a text and, say, want to highlight a couple of words with bold, the </b> tag which is inserted just after <b> makes you press the right arrow several times to skip it so that you can continue typing.
To smoothen the editing, use CTRL+[ and CTRL+] keyboard shortcuts that let you navigate to the first character of an opening tag or to the last character of a closing tag.
IDEA Quick Tag Jump
In this particular case, when you are done typing text inside the <b></b>, press CTRL+] and then right arrow to get outside the tag. No matter how long it is (<em>, <font>, <strong>) you can leave it just in two key strokes and go on typing your code.
These shortcuts are also really handy for quick jumping through lengthy tags without folding them.

Technorati tags: , , ,
Comments below can no longer be edited.

5 Responses to Smoothen HTML and XML editing in IntelliJ IDEA

  1. Esko Luontola says:

    July 21, 2006

    How can I change those buttons because I’m using the Finnish keyboard layout (http://en.wikipedia.org/wiki/Keyboard_layout#Swedish.2FFinnish) and writing [ and ] requires pressing AltGr+8 or AltGr+9. I didn’t find those shortcuts from the Settings > Keymap.

    It would be nice if IDEA would recognize the keyboard layout which is being used, or give an option to choose it manually (in Settings > Keymap), and move the default shortcut keys to the same positions in the keyboard regardless of what the actually reads on the key. So for example it would automatically change the Ctrl+[ and Ctrl+] shortcuts to Ctrl+Å and Ctrl+¨ when using a Finnish keyboard layout. Should I file a JIRA request?

  2. Egor Malyshev says:

    July 21, 2006

    Yes, JIRA request about this would be very welcome.
    As for Keymap, you can find these shortcuts under ‘Move Caret to Code Block Start’ and ‘Move Caret to Code Block End’ and reassign them to the keys you want.

  3. Yegor Yarko says:

    July 25, 2006

    What is the purpose of placing the caret _inside_ the tag on CTRL+] ? Why can one want to add to the closing tag name?
    Seems, | would be more helpful then . This way I could type right after jumping to the end of the tag without extra right arrow. What do you think?

  4. Yegor Yarko says:

    July 26, 2006

    Tags were stripped 🙁
    Another try:
    Seems, </b>| would be more helpful than </b|>.
    That is, placing the caret right _after_ the tag vs. inside the tag.

  5. Egor Malyshev says:

    July 26, 2006

    This feature is initailly designed to navigate through code blocks (as you can judge from its name), so it places the caret this way. This tip just shows how you can use it to quickly navigate through tags as you type.
    The aim is that you can get outside of any tag just with CTRL+], RightArrow. Two keystrokes, no matter how long the tag name is. You may file a JIRA request to discuss whether is worth adding another shortcut that would replace this key sequence (which is more likely to adding a small feature “Jump Outside Tag”).

Subscribe

Subscribe for updates