Sublime Text 2和Emmet和包装线

时间:2013-12-20 19:25:45

标签: sublimetext2 emmet

我经常从客户端获取文本,并希望使用html标签快速格式化文本,并将每个文本行换行为指定的字符数。我刚刚安装了Sublime Text 2,它非常好,但我真正想做的事情之一就是我无法理解。

我想要使用长段落,将每个段落包装在段落p标记中,然后将这些行包装起来,使它们不会在屏幕上运行。所以这就是我正在做的事情:

  1. 将客户端的文本复制并粘贴到编辑器中(本例中为2段)。

  2. 选择文字。

  3. 使用Emmet,输入“p *”,将p标签放在每个段落的开头,将/ p放在每个段落的末尾。

  4. 选择文字。

  5. 单击Alt Q以包装文本。

  6. 文字换行,但它已损坏,因为开放角括号“<”从/ p标记附加到每行的开头,并且/ p标记中缺少开口尖括号。

    <p>Our swimming lessons run on a perpetual monthly enrollment system,
    <making year-round lessons affordable and convenient. Our online
    <registration system allows you to sign up at your convenience and
    <monitor your account details easily./p>
    
    <p>Our highly trained swim instructors teach our unique, proven
    <curriculum in stages, encouraging swimmers to master the fundamentals
    <of every important swimming skill. We continuously encourage
    <progression and advancement as each swimmer becomes more confident in
    <the water. Our program blends important water safety skills, buoyancy
    <principles and correct stroke technique./p>
    

    帮助!我做错了什么?

1 个答案:

答案 0 :(得分:0)

以下是您可以做的事情:

  1. 粘贴客户端内容。
  2. 选择,按 Alt Q 进行换行。您现在将有两个游标,每个游标末尾有一个游标。
  3. 选择Selection -> Expand Selection to Paragraph(稍后我将向您展示如何制作快捷方式)。现在选择了两个段落,每个段落都作为选择区域。
  4. 使用 Ctrl Shift G 打开Emmet并输入p {{1 }})
  5. 点击输入,你应该有两个被p*标签包围的包装段落:
  6. <p></p>

    要为<p>Our swimming lessons run on a perpetual monthly enrollment system, making year-round lessons affordable and convenient. Our online registration system allows you to sign up at your convenience and monitor your account details easily.</p> <p>Our highly trained swim instructors teach our unique, proven curriculum in stages, encouraging swimmers to master the fundamentals of every important swimming skill. We continuously encourage progression and advancement as each swimmer becomes more confident in the water. Our program blends important water safety skills, buoyancy principles and correct stroke technique.</p> 创建键盘快捷键,请转到Expand Selection to Paragraph并添加以下内容:

    Preferences -> Key Bindings - User

    如果文件为空,请将上面的行换成方括号{ "keys": ["ctrl+alt+shift+p"], "command": "expand_selection_to_paragraph" }

    []

    保存文件,您现在应该可以使用 Ctrl Alt Shift P 执行第3步以上。如果您愿意,可以随意更改组合键,但请注意,它可能与其他内置或插件组合冲突。

    注意:我在Sublime Text 3上测试了所有这些,但它在ST2中应该是一样的。