kalmdown
kalmdown

Reputation: 641

VSCode - Is there a way to apply snippets to each line of a selection?

I have a snippet. I want to select multiple lines - a set of relative paths to images that I have pasted in - and have the snippet be applied to each line separately. The snippet menu doesn't seem to have the same capabilities as Emmet (* treats each line separately)

Upvotes: 0

Views: 765

Answers (1)

rioV8
rioV8

Reputation: 28673

  • add multi cursors at each line: use Ctrl+Alt+Down or Ctrl+Alt+Up
  • or any other method for multi cursor if you have few Alt+Click or a lot Shift+Alt+Click
  • select the text of each line
  • type the snippet prefix and select the snippet

this works if the snippet uses the variable ${TM_SELECTED_TEXT}

Upvotes: 3

Related Questions