Search code examples
htmlvim

How can I find the closing HTML tag quickly in Vim?


Just like editing C source files, I can press % to get the closing } for the current cursor's {.

How can I do this when editing HTML files? Are there any shortcuts?

To be clear, I want:

<html>
</html>

When the cursor moves to <html>, I want to press a key so that the cursor will jump to </html>.


Solution

  • You should be able to do this with the matchit plugin by typing % when your mouse is on the opening tag.

    http://www.vim.org/scripts/script.php?script_id=39