skip to Main Content

I have a text file containing 100 lines of words.
Need to wrap them all in li tags to display as bullet points on a website.
How to do so fast in VS code using some shortcut?
If I paste the text in VS code, it takes up 100 lines with one word on each line.

2

Answers


    1. Hit Ctrl + H
    2. Enable Regular Expression
    3. Enter ^(.*)$ in Find
    4. Enter <li>$1</li> in Replace
    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>
    
    Login or Signup to reply.
    • place cursor on line 1 and Shift+Alt+Click on line 100
    • press Home and Shift+End
    • execute command: Emmet: wrap with abbreviation
    • enter li and Enter
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search