Jump to Closing tag in VS Code?

TagsKeyVisual Studio-CodeBrackets

Tags Problem Overview


I can't seem to find a way to select the beginning of a bracket and jump to the end of it through some key combination or something in VS Code. For example, in atom, this is done with Ctrl + m.

I know there is a way to jump to the beginning and end of a bracket or curlybraces with Cmd + Shift + </kbd> but that does not work for tags. Any ideas?

Tags Solutions


Solution 1 - Tags

It is possible to do, but either using Ctrl + Shift + P -> "Emmet: Go to Matching Pair" or by manually setting a shortcut for it (Ctrl + K Ctrl + S).

Unfortunately there is currently no support for it out of the box.

Solution 2 - Tags

You can use Cmd + % to jump tags in VSCode if you add the following to your keybindings.json.

{
    "key":"cmd+shift+5",
    "command": "editor.emmet.action.matchTag"
}

Go to: File > Preferences > Keyboard Shortcuts and click the underlined link to edit keybindings.json.

For those using VIM keys: you are already used to pressing % to jump to matching parens and tags. So, hopefully, Cmd + % will be close enough to your existing muscle memory to make this transition painless.

Solution 3 - Tags

For those who are using Vim plugin and Mac, Leader+% is working well for me.

You can setup in your Vim json file setting.json by adding:

"vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": ["<leader>", "%"],
      "commands": [
        {
          "command": "editor.emmet.action.matchTag"
        }
      ]
    }
]

PS. I mentioned Mac user because cmd+shift+5 is for capturing the screen in Mac.

Solution 4 - Tags

You can jump to the matching bracket with Ctrl+Shift+</kbd>

For more reference, you can refer: Visual Studio Code Navigation

Solution 5 - Tags

I think you are asking about Breadcrumb Keyboard Navigation

In this case you can simply press Ctrl+Shift+. to go to elements before or after the current element.

Solution 6 - Tags

There is no support for this out of the box. Though if you are willing to use extensions, there is: https://marketplace.visualstudio.com/items?itemName=vincaslt.highlight-matching-tag which among other things, gives you ability to use command: Jump to matching tag which you can bind to a key.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCiprian TurcuView Question on Stackoverflow
Solution 1 - TagsJakub JurkianView Answer on Stackoverflow
Solution 2 - Tagsf1lt3rView Answer on Stackoverflow
Solution 3 - TagsFFEVERView Answer on Stackoverflow
Solution 4 - TagsShirish DhotreView Answer on Stackoverflow
Solution 5 - TagsOptimaz IDView Answer on Stackoverflow
Solution 6 - TagsVincas StonysView Answer on Stackoverflow