Ben Hourigan
Ben Hourigan

Reputation: 13

How to insert characters before rectangular block selection in JOE Editor?

When you have made a rectangular block selection in Joe (using ^TX, ^KB [move cursor] ^KK), how can you use it to insert characters on multiple lines?

For instance, say we have this text:

Lorem ipsum dolor sit amet, consectetur 
adipiscing elit. Pellentesque pretium elementum eros,
ac dignissim purus volutpat et. Integer eleifend, odio.

And we want to change it to:

% Lorem ipsum dolor sit amet, consectetur 
% adipiscing elit. Pellentesque pretium elementum eros,
% ac dignissim purus volutpat et. Integer eleifend, odio.

I want this specifically for LaTeX, but this situation of wanting to comment out a multi-line block appears in many other contexts.

I know this is possible by setting up a macro and repeating it across multiple lines, but it would be good to be able to make arbitrary multi-line insertions and deletions as needed.

Is this even possible in Joe? How is it done?

Upvotes: 1

Views: 218

Answers (1)

zhenya1007
zhenya1007

Reputation: 26

Mark your block of text (cursor to 'L' in 'Lorem', ^KB, cursor to '.' in 'odio.', ^KK), then filter it (^K/) through, sed -e 's/^/% /' (or perl -lne 'print qq(% ),$_', or awk, or...). Yes, it's possible. :-)

Upvotes: 1

Related Questions