在 VS 代码中跳转到关闭标记? ?

我似乎不能找到一种方法来选择一个支架的开头,并通过一些键组合或在 VS 代码的东西跳到它的结束。例如,在 原子中,这是通过 Ctrl + m完成的。

我知道有一种方法可以用 Cmd + Shift + \跳到括号或花括号的开头和结尾,但是这种方法不适用于标记。有什么想法吗?

54063 次浏览

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.

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.

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.

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.

You can jump to the matching bracket with Ctrl+Shift+\

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

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.