Sublime Text 2 中关闭 HTML 标签的快捷方式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18137940/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:58:54  来源:igfitidea点击:

Short cut for close HTML tag in Sublime Text 2

htmlsublimetext2

提问by Rich

Is there a shortcut to close the HTML tag you've just opened in sublime text 2?

是否有关闭您刚刚在 sublime text 2 中打开的 HTML 标签的快捷方式?

回答by Rich

I just found out pressing

我刚发现按

For Mac:Alt+ Command+ .

对于 Mac:Alt+ Command+.

For PC:Alt+ .

个人电脑:Alt+.

For Linux:Alt+ .

对于 Linux:Alt+.

will finish the tag you currently have open.

将完成您当前打开的标签。

E.g. you type

例如你输入

<div>

Pressing the shortcut will give you

按快捷键会给你

</div>

回答by chili434

You can just type the type of tag you would like to insert and press tab!

您只需输入要插入的标签类型,然后按 Tab 键即可!

Examples:

例子:

  • Type divthen press Tabto get <div></div>with the cursor in the tag's content, and tab again to exit the tag.
  • Type athen press Tabto get <a href=""></a>with the cursor in the quotes, tab again to move to the tag's content, and tab again to exit the tag
  • 键入div然后按Tab以获得<div></div>再次用光标在标签的内容和标签退出标签。
  • 键入a然后按Tab<a href=""></a>将光标置于引号中,再次按 Tab 移动到标签的内容,再次按 Tab 退出标签

回答by jsNovice

Type div and then Tab. It automatically expands to in sublime text 2.

键入 div,然后键入 Tab。它会自动扩展到 sublime text 2。

回答by Taylan

Ctrl + Shift + <which is Edit > Tag > Close Tag

Ctrl + Shift + <即编辑 > 标签 > 关闭标签

UPDATE

更新

After seeing Rich's answer I remembered that I've changed the shortcut for this command.

看到 Rich 的回答后,我记得我已经更改了此命令的快捷方式。

回答by Patrick Yan

Not sure where the other people got their shortcuts from. On my version of Sublime Text 2, it's ALT+ ?+ .(Mac OS X)

不知道其他人从哪里得到他们的捷径。在我的版本崇高文本2,它的ALT+ ?+.键(Mac OS X)

回答by Connor Leech

Install "HTMLAttributes" package hereor install it via Preferences > Package Explorer > Install Package

在此处安装“HTMLAttributes”包或通过首选项 > 包资源管理器 > 安装包进行安装