Extend selection to allow multiple editing in the source editor

Hi,

when I select a word (e.g., a variable name) in the source editor, all identical words in the source are highlighted: e.g.

image

Is there a way to extend the selection to the rest of the highlighted text, so that I can perform multiple editing? This is a common feature in source editors, see for example:

http://www.sublimetext.com/docs/selection

1 Like

It's definitely doable (see, for example, this snippet):

And multiple-selection edit works with Find and Replace…

Multiple cursors can be enabled using ctrl+alt+a

2 Likes

Hi @mara,

thanks for the reply: ctrl + alt + a (hey, how do you create those nice-looking keys?!) creates two cursors, one before and one after the word, but not one at each of the highlighted words. Example:

stringy <- "foo"
print(stringy)
stringy <-paste0(stringy, "bar")

If I select stringy on the first line, ctrl + alt + a will give me a cursor before and after the word stringy on the first line, but I was actually looking for a cursor before the word stringy, on each line. I can insert multiple cursors in different lines at the same column keeping the Alt button pressed, but again, this is different from what I looked for. I guess the only other solution is to use Find & Replace, right?

Ps I didn't understand the snippet part, sorry! I'm not familiar with snippets

Yes!

  1. Press Cmd + F
  2. Type your word (e.g. exact_risk) in the Find box
  3. Click the All button

You'll now have multiple cursors, one at each match.

3 Likes

Thanks! I see that I can also select the word with the mouse, press Cmd + F (yay! I learned :slightly_smiling_face:) and then click All as you suggested. It works also this way.

@mara, I now see you were giving me the same suggestion but I didn't get it the first time :sweat_smile:

1 Like