简体   繁体   English

将多行文本包装在同一标签中的 VS 代码快捷方式?

[英]VS code shortcut to wrap multiple lines of text in same tag?

I have a text file containing 100 lines of words.我有一个包含 100 行单词的文本文件。 Need to wrap them all in li tags to display as bullet points on a website.需要将它们全部包装在 li 标签中,以在网站上显示为项目符号。 How to do so fast in VS code using some shortcut?如何使用一些快捷方式在 VS 代码中快速完成? If I paste the text in VS code, it takes up 100 lines with one word on each line.如果我将文本粘贴到 VS 代码中,它会占用 100 行,每行一个单词。

  1. Hit Ctrl + H按 Ctrl + H
  2. Enable Regular Expression启用正则表达式
  3. Enter ^(.*)$ in Find在查找中输入^(.*)$
  4. Enter <li>$1</li> in Replace在替换中输入<li>$1</li>
  5. Profit利润
foo
bar
baz asdad
foo bar baz 123

Becomes变成

<li>foo</li>
<li>bar</li>
<li>baz asdad</li>
<li>foo bar baz 123</li>
  • place cursor on line 1 and Shift+Alt+Click on line 100将 cursor 放在第 1 行,然后Shift+Alt+Click第 100 行
  • press Home and Shift+EndHomeShift+End
  • execute command: Emmet: wrap with abbreviation执行命令: Emmet:用缩写换行
  • enter li and Enter输入liEnter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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