Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there some way to edit multiple rows simultaneously in XCode 4?

Tags:

xcode

xcode4

The one thing I miss when using Xcode, having spent most of my career in Visual Studio and having, for the most part, come to prefer Xcode over the last few years, is the ability to edit multiple rows of text simultaneously.

In VS, this is accomplished by alt-dragging a columnar selection, then typing. Whatever you type appears on all rows at once. So you can convert this:

glVertex2f( 1, -1 );
glVertex2f( 1,  0 );
glVertex2f( 1,  1 );

...to this...

glVertex2f( -1, -1 );
glVertex2f( -1,  0 );
glVertex2f( -1,  1 );

...with a single keystroke. Or perhaps you meant to type "glVertex2i". All those f's can turn to i's in a moment. This feature is amazingly handy in a wide variety of situations.

Xcode also allows columnar selection with alt+drag. However, after making such a selection, typing only modifies the first row of text, as if only the first row had been selected.

Is there an option, a plugin—anything—that enables multi-row editing in Xcode?

I'm currently in version 4.3.1, BTW.

like image 574
OldPeculier Avatar asked Mar 28 '12 20:03

OldPeculier


People also ask

How do you modify multiple lines?

What you do put your cursor where you want to add a character on a line, then use SHIFT+ALT and either the arrow keys or your mouse (you have to click to the same column position the line that you are selecting to) to select all the lines that you want to edit the same way.

How do I select the same word in Xcode?

This is where the Edit all in scope command comes to rescue. The way edit all in scope works is you select the word that you would like to replace and press ^⌘E. This will highlight all the occurrences of your selected word in the current file.


1 Answers

Not a perfect solution but maybe this can help you...

Edit all in scope

like image 86
Daniel Åkesson Avatar answered Nov 15 '22 10:11

Daniel Åkesson