How to wrap each line in quotes in SublimeText?
Solution 1:
I would use a multiple cursors approach like this:
Windows
- Ctrl + A (Select everything)
- Ctrl + Shift + L (Split into lines)
- End (Put the cursor at the end of the line)
- " (Add the quote at the end of the line)
- Home (Go to the first character of the line)
- Home (Go to the beginning of the line... like if you have tabs or spaces)
- " (Add the quote at the beginning of the line)
Mac
- Cmd + A (Select everything)
- Cmd + Shift + L (Split into lines)
- Cmd + → (Put the cursor at the end of the line)
- " (Add the quote at the end of the line)
- Cmd + ← (Go to the first character of the line)
- Cmd + ← (Go to the beginning of the line... like if you have tabs or spaces)
- " (Add the quote at the beginning of the line)
Solution 2:
Method 1:
- no multiple cursors
- + best performance (use for large files)
- - slightly clumsy
Replace (.*)
with "\1"
Method 2:
- multiple cursors
- + best in regards to usability/comfort
- - slower for bigger files
- - wont work if the file has empty lines
Ctrl+a, Ctrl+Shift+l, "
Method 3:
- multiple cursors
- + close to #2 as usability, but works always
- - slower for bigger files
Ctrl+a, Ctrl+Shift+l, End, "
, Home, "
Solution 3:
None of these worked in Sublime Text 3 for a multi-column TSV file with tab spacing.
I found this worked for column 1:
Find: ^\s*\S+
Replace: "$0"