简体   繁体   中英

Short cut for close HTML tag in Sublime Text 2

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

I just found out pressing

For Mac: Alt + Command + .

For PC: Alt + .

For Linux: Alt + .

will finish the tag you currently have open.

Eg you type

<div>

Pressing the shortcut will give you

</div>

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

Examples:

  • Type div then press Tab to get <div></div> with the cursor in the tag's content, and tab again to exit the tag.
  • Type a then press Tab to 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

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

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

UPDATE

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM