Multi-line editing on Atom
Asked Answered
D

4

15

I have this task that I need to complete fast as possible. I have coupon codes (over 1000), I going to create an array out of it. To do that fast as possible I need to be able select multiples lines and edit them at the same time. I am using Atom as my editor choice. I tried to search online for answers but non found.

ST55672
SE82673
SS85074
SD65675
SH75676

to:

"ST55672",
"SE82673",
"SS85074",
"SD65675",
"SH75676",

PS. Im using Mac

Diella answered 8/9, 2016 at 13:1 Comment(3)
I'm aware notepad++ allows you to do this, as well as sublime text, haven't tried doing it in Atom yet. Couldn't you write a small script to do that though? I imagine editing 1000+ lines in an editor regardless of which editor you do it in, isn't very pleasant. P.S. The script'll probably take you about 8-10 lines.Tillo
You can use emacs style macros with atom-ymacs ( atom.io/packages/ymacs-editor ). Start a macro with ctrl-x ( , quote the string, end the macro with ctrl-x ) and save back to atom. You can execute the macro 1000 times by typing ctrl-u 1000 ctrl-x e .Oas
I don't think Notepad++ is on MacDiella
L
24

1. Atom Commands

Select all text (Cmd+A on Mac, Ctrl+A elsewhere), then use the shortcut to “split the selection into lines” (Cmd+Shift+L on Mac, Ctrl+Shift+L elsewhere). Both commands are also available from the command palette.

PS: like many other keyboard shortcuts, these also work in Sublime Text

2. RegEx Search & Replace

Search for ^(.*)$ and replace with "$1",.

Lasala answered 8/9, 2016 at 15:50 Comment(4)
I think that should be ^(.*)$ to ensure string capture to $1.Subduct
Thank you so much idleberg! I tried the first one and it worked!Diella
On Windows and Linux, there is no shortcut for split selection into lines. ctrl+shift+L is mapped to something else. You have to select it from the selection menu on the top bar.Jesher
If there is no Ctrl+Shift+L shortcut, you can add it as explained here.Anaemia
M
1

Notice for windows users:

multiline cursor works using these keys in the following order :

CTRL + ALT +

and , or , or a mouse "Click" any where you need

Mickey answered 5/3, 2018 at 11:51 Comment(0)
B
0

  1. select all lines

  2. Go to selection menu on the top bar (win & Linux)

  3. select split selection into lines
Bargeboard answered 26/4, 2020 at 9:45 Comment(0)
G
0

Use Shift<->CTRL and ↓ to select all lines at at time for editing in mac.

Gothicize answered 2/4, 2024 at 13:17 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.