[英]Find closing HTML tag in Sublime Text
I have a very long and very nested HTML document, where I need to quickly find the closing tag. 我有一个非常长且非常嵌套的HTML文档,我需要快速找到结束标记。 How can I do this?
我怎样才能做到这一点?
Try Emmet plug-in command Go To Matching Pair : 试试Emmet插件命令Go To Matching Pair :
http://docs.emmet.io/actions/go-to-pair/ http://docs.emmet.io/actions/go-to-pair/
Shortcut (Mac): Shift + Control + T 快捷方式(Mac): Shift + Control + T.
Shortcut (PC): Control + Alt + J 快捷方式(PC): Control + Alt + J.
https://github.com/sergeche/emmet-sublime#available-actions https://github.com/sergeche/emmet-sublime#available-actions
There is a shortcut ( Ctrl + Shift + A for Windows and Linux users, Command + Shift + A for Mac users) to select the whole block within the currently selected tag. 有一个快捷方式(对于Windows和Linux用户为Ctrl + Shift + A ,对于Mac用户为Command + Shift + A ),用于选择当前所选标记内的整个块。
For example, if you pressed this while your text cursor was within the outer div
tag in the code below, all the div
s with class selected
would be selected. 例如,如果您在文本光标位于下面代码中的外部
div
标记内时按此div
,则将selected
所有具有selected
类的div
。
<div class='current_tag_block'>
<div class='selected'></div>
<div class='selected'></div>
<div class='selected'></div>
<div class='selected'></div>
</div>
It's built in from Sublime Editor 2 at least. 它至少来自Sublime Editor 2。 Just press the following and it balances the HTML-tag
只需按下以下内容即可平衡HTML标记
Shortcut (Mac): Shift + Command + A 快捷方式(Mac): Shift + Command + A.
Shortcut (Windows): Control + Alt + A 快捷方式(Windows): Control + Alt + A.
Under the "Goto" menu, Control + M is Jump to Matching Bracket. 在“转到”菜单下, Control + M跳转到匹配括号。 Works for parentheses as well.
也适用于括号。
As said before, Control
/ Command
+ Shift
+ A
gives you basic support for tag matching. 如前所述,
Control
/ Command
+ Shift
+ A
为您提供标签匹配的基本支持。 Press it again to extend the match to the parent element. 再按一次将匹配扩展到父元素。 Press arrow left/right to jump to the start/end tag.
按向左/向右箭头跳转到开始/结束标记。
Anyway, there is no built-in highlighting of matching tags. 无论如何,没有匹配标签的内置突出显示。 Emmet is a popular plugin but it's overkill for this purpose and can get in the way if you don't want Emmet-like editing.
Emmet是一个很受欢迎的插件,但是对于这个目的来说它太过分了,如果你不想要Emmet一样的编辑,它可能会受到阻碍。 Bracket Highlighter seems to be a better choice for this use case.
Bracket Highlighter似乎是这个用例的更好选择。
None of the above worked on Sublime Text 3 on Windows 10, Ctrl + Shift + ' with the Emmet Sublime Text 3 plugin works great and was the only working solution for me. 以上都不适用于Windows 10上的Sublime Text 3,使用Emmet Sublime Text 3插件的Ctrl + Shift +'效果很好,是我唯一可行的解决方案。 Ctrl + Shift + T re-opens the last closed item and to my knowledge of Sublime, has done so since early builds of ST3 or late builds of ST2.
Ctrl + Shift + T重新打开最后一个关闭的项目,据我所知Sublime,自ST3的早期构建或ST2的后期构建以来已经这样做了。
I think, you may want to try another approach with folding enabled. 我想,你可能想尝试另一种启用折叠的方法。
In both ST2 and ST3, if you enable folding in User settings: 在ST2和ST3中,如果在用户设置中启用折叠:
{
...(previous item)
"fold_buttons": true,
...(next item, thus the comma)
}
You can see the triangle folding button at the left side of the line where the start tag is. 您可以在开始标记所在行的左侧看到三角形折叠按钮。 Click it to expand/fold.
单击它以展开/折叠。 If you want to copy, fold and copy, you get all block.
如果你想复制,折叠和复制,你会得到所有阻止。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.