Inserting characters at the beginning of multiple lines


#1

I want to insert some characters at the beginning of multiple lines. (Called ‘string-rectangle’ feature on Emacs)

For example,

from:

a
b
c

to:

> a
> b
> c

#2

I resolved it with https://atom.io/packages/sublime-style-column-selection. Cmd + Shift + L and move a cursor at the beginning of lines, then insert "> ".


#3

Any updates on how to do this? 3 lines or 10 lines isn’t a big deal, but dozens of lines is a pain to manually insert a character. (I need to insert * at the beginning of a section of text, so that it works with a C-style comment.


#4

Actually never mind, I just searched for \n and replaced with \n *


#5

The answer is above: this is still not a native feature of Atom, but the indicated package works well.


#6

You can hold ctrl-alt then use the arrow keys to select multiple lines. No third party packages required. See this.


#7

i highlight the text and then Cmd + Shift + L and then i try to move the cursor to end of line and add the comma and i get

I cant get my comma at the end of every line.


#8
  1. You’re on Windows. You have no cmd key, which is only on Mac. You’re probably thinking of ctrl.
  2. The keybinding ctrl-shift-l, on Windows, is the default binding for the command grammar-selector:show.

Have you installed sublime-style-column-selection?

Given your use case, it would be easier for you to just add extra cursors. Just put your mouse at the end of the first line and click. Then put your mouse at the end of the second line and press ctrl while clicking.


#9

i added the sublime-style-column-selection .
in my selection drop down from menu bar, the short cut keys are not for windows. how do I get them to be for windows? add selection below= alt ctrl arrow dow.n flips my entire computer screen upside-down.

how do i select the first column of words?


#10

The documentation on this page shows you how to control the sublime-style-column-selection package. If you are seeing a behavior from a package you don’t recognize, you can open the Keybinding Resolver using ctrl-.. If you post a screenshot of that, I can explain what you’re seeing.


#11

I was able to do this by:

#1 Select all [ctrl+A]
#2 Go to Selection Tab > Click on Split into lines
#3 Then Shift + Home
#4 Now, you can type anything and it will be added to the starting of each line!


#12

This is the solution that worked for me. Thank you for this answer!