Vertical Block Editing in BBEdit

8,657 views
Skip to first unread message

SJR

unread,
Aug 4, 2009, 10:16:57 AM8/4/09
to BBEdit Talk
Does anyone know if it is possible to do the equivalent of Coda's
(Panic Software) 'BlockEdit Selection' in BBEdit?

This extremely useful feature allows you to insert the same text on
multiple lines of code at once.

I'm sure it must be in here somewhere! Everything else is!

Dennis

unread,
Aug 7, 2009, 1:22:06 AM8/7/09
to bbe...@googlegroups.com
On Aug 4, 2009, at 7:16 AM, SJR wrote:

> Does anyone know if it is possible to do the equivalent of Coda's
> (Panic Software) 'BlockEdit Selection' in BBEdit?

I'm not familiar with Coda's 'BlockEdit Selection' feature, but it
sounds similar to BBEdit's rectangular selections. Hold down the
Option key while dragging your cursor across some text (soft wrap must
also be disabled). You can then do all normal text operations on the
resulting rectangular selection. See page 91 of the user manual for
more information.

I often use rectangular selections with BBEdit's Text -> "Prefix/
Suffix Lines..." command to add/remove text across multiple, similar
lines all at once, like a list of variable declarations. It's a
powerful combination of features.

Hope this helps.

-Dennis

Lewis@Gmail

unread,
Aug 7, 2009, 2:48:36 PM8/7/09
to bbe...@googlegroups.com

On Aug 6, 2009, at 23:22, Dennis <arge...@mac.com> wrote:

> I often use rectangular selections with BBEdit's Text -> "Prefix/
> Suffix Lines..." command to add/remove text across multiple, similar
> lines all at once, like a list of variable declarations. It's a
> powerful combination of features.

It very often eliminates the need for building a regex. I just forget
to do it. I forget about 90% of what BBEdit can do, and it's still
amazing.

--
Sent from my iPhone


SJR

unread,
Aug 24, 2009, 5:58:47 AM8/24/09
to BBEdit Talk
Hi Dennis,

Thanks for your reply. I have had a look at this feature now, and
whilst it looks useful, it doesn't do quite what I wanted...

For example, in Coda, I can select multiple lines of text, right-click
and select Blockedit Selection. The selected text background changes
from blue to grey (to indicate change of editing mode) and I can the
type anything on any of the selected lines and it will be faithfully
reproduced on every selected line.

Prefix/Suffix does this for me at the start and end of selected text,
but I wish to do this at any point within the text

e.g.

Here is a line of text
Here is a line of text
Here is a line of text
Here is a line of text
Here is a line of text

I then want to 'blockedit' this so that I can insert the word 'new' on
every line

i.e.
Here is a new line of text
Here is a new line of text
Here is a new line of text
Here is a new line of text
Here is a new line of text

I can do this in Coda simply by selecting all lines then typing the
word 'new' once on the first selected line, in the appropriate
position, and all selected lines then appear as above. Likewise, any
deleting done on a single line will be repeated on all other selected
lines...

It is a shame if this isn't possible in BBEdit, as I prefer it to Coda
in all other ways, but this feature means that I will need to hang on
to Coda for those occasions (frequent!) when I need to do the same
editing on multiple lines of text.

Cheers,

Steve
On Aug 7, 6:22 am, Dennis <argent...@mac.com> wrote:
> On Aug 4, 2009, at 7:16 AM, SJR wrote:
>
> > Does anyone know if it is possible to do the equivalent of Coda's
> > (Panic Software) 'BlockEditSelection' in BBEdit?
>
> I'm not familiar with Coda's 'BlockEditSelection' feature, but it  

Patrick Woolsey

unread,
Aug 24, 2009, 9:12:10 AM8/24/09
to bbe...@googlegroups.com
SJR <sral...@googlemail.com> sez:
[...]

>Prefix/Suffix does this for me at the start and end of selected text,
>but I wish to do this at any point within the text

You can apply Prefix/Suffix Lines at an arbitrary position as well.

Taking your example, just make a zero-width columnar selection by setting
the insertion point before "line", then Option-dragging straight down
through the desired range of lines.

----


Here is a |line of text
Here is a |line of text
Here is a |line of text
Here is a |line of text

A line of text that I'm not changing.
A line of text that I'm not changing.
----

where | shows the position of the column selection. (For a better
representation than my ASCII art :), please see "Working with Rectangular
Selections" in the PDF manual.)

Once you've got this selection, just apply Prefix/Suffix lines with "new ".

----


Here is a new line of text
Here is a new line of text
Here is a new line of text
Here is a new line of text

A line of text that I'm not changing.
A line of text that I'm not changing.
----


Regards,

Patrick Woolsey
==
Bare Bones Software, Inc. <http://www.barebones.com>
P.O. Box 1048, Bedford, MA 01730-1048

Robert A. Rosenberg

unread,
Aug 24, 2009, 3:52:48 PM8/24/09
to bbe...@googlegroups.com
At 02:58 -0700 on 08/24/2009, SJR wrote about Re: Vertical Block
Editing in BBEdit:

>Prefix/Suffix does this for me at the start and end of selected text,
>but I wish to do this at any point within the text
>
>e.g.
>
>Here is a line of text
>Here is a line of text
>Here is a line of text
>Here is a line of text
>Here is a line of text
>
>I then want to 'blockedit' this so that I can insert the word 'new' on
>every line
>
>i.e.
>Here is a new line of text
>Here is a new line of text
>Here is a new line of text
>Here is a new line of text
>Here is a new line of text

Why not select the lines and then just do a find/replace of "a l" to
"a new l" with Selected Text Only checked?

--


Robert A. Rosenberg
RAR Programming Systems Ltd.
(845)-357-0931 - Home
(646)-479-1984 - Cell Phone
(646)-349-4025 - Fax

SJR

unread,
Aug 27, 2009, 10:06:54 AM8/27/09
to BBEdit Talk
Patrick / Robert,

Thank you for all your suggestions - this has made things a lot easier
for me!

Cheers,

Steve
Reply all
Reply to author
Forward
0 new messages