How to wrap each line in quotes in SublimeText?

Aniket Suryavanshi picture Aniket Suryavanshi · Aug 20, 2015 · Viewed 30.7k times · Source

Input:

boston beach summer figural yellow blue
boston floral flowers still still-life food pink figural
boston horse pink purple house flowers floral figural

Expected output:

"boston beach summer figural yellow blue"
"boston floral flowers still still-life food pink figural"
"boston horse pink purple house flowers floral figural"

The actual input file has 600+ lines, and I'm looking at a quick way to wrap each line in quotes? Does the method involve using multiple cursors? How about macros?

Answer

Maxime picture Maxime · Aug 20, 2015

I would use a multiple cursors approach like this:

Windows

  1. Ctrl + A (Select everything)
  2. Ctrl + Shift + L (Split into lines)
  3. End (Put the cursor at the end of the line)
  4. " (Add the quote at the end of the line)
  5. Home (Go to the first character of the line)
  6. Home (Go to the beginning of the line... like if you have tabs or spaces)
  7. " (Add the quote at the beginning of the line)

Mac

  1. Cmd + A (Select everything)
  2. Cmd + Shift + L (Split into lines)
  3. Cmd + (Put the cursor at the end of the line)
  4. " (Add the quote at the end of the line)
  5. Cmd + (Go to the first character of the line)
  6. Cmd + (Go to the beginning of the line... like if you have tabs or spaces)
  7. " (Add the quote at the beginning of the line)