Discussion:
Hard Wrap from bbedit CLI
Jim Correia
2008-04-19 16:58:46 UTC
Permalink
Is there a way to specify the wrap margin when launching bbedit from
the cli? Is there a way to specify it as a HARD wrap? Is there
anyway to tell BBEdit to hard wrap a new document? All the instances
of 'wrap' in the manual are about soft wrap.
What specifically are you doing?

Literally launching BBEdit from the command line - `bbedit --launch` -
doesn't deal with documents at all.

`bbedit path` will open the file at the path, but not have any side
effects on the data. (Hard wrap is a side effect on the data.)

`some_command | bbedit` will create an untitled document with the data
as it is passed. If you want to have side effects on the data,
transform it before piping it to BBEdit.

Without knowing what you are trying to do, it is hard to offer more
specific advice.

In theory, wrapping the BBEdit tool with a script that pre-process
data might be a solution. Replacing `bbedit` with your own script that
opens/creates documents and post-processes them is another (though, if
you are relying on --wait, this becomes non-trivial.)

Jim
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Lewis@Gmail
2008-04-19 16:26:31 UTC
Permalink
Is there a way to specify the wrap margin when launching bbedit from
the cli? Is there a way to specify it as a HARD wrap? Is there anyway
to tell BBEdit to hard wrap a new document? All the instances of
'wrap' in the manual are about soft wrap.
--
There is something to be said for grace and respect but humour alway
helps -
Toby Morris
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Lewis@Gmail
2008-04-20 17:11:27 UTC
Permalink
Post by Jim Correia
Is there a way to specify the wrap margin when launching bbedit
from the cli? Is there a way to specify it as a HARD wrap? Is
there anyway to tell BBEdit to hard wrap a new document? All the
instances of 'wrap' in the manual are about soft wrap.
What specifically are you doing?
Editing files form the CLI that need to be wrapped at 72 characters.

I can do this with nano and vi (eg vim +'set tw=72'), but not in bbedit.
--
Yeah, Nick. Nick's the kinda guy you can trust. Nick's your buddy
Nick's the
kinda guy you drink beers with. The kinda guy that doesn' care if you
puke in his car. Nick.
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Jim Correia
2008-04-21 01:27:15 UTC
Permalink
Post by ***@Gmail
Post by Jim Correia
Is there a way to specify the wrap margin when launching bbedit
from the cli? Is there a way to specify it as a HARD wrap? Is
there anyway to tell BBEdit to hard wrap a new document? All the
instances of 'wrap' in the manual are about soft wrap.
What specifically are you doing?
Editing files form the CLI that need to be wrapped at 72 characters.
I can do this with nano and vi (eg vim +'set tw=72'), but not in bbedit.
That is still somewhat vague.

Are you doing the equivalent of

user types `emacs file`
user edits file
user saves file and exist to terminal

Or are you trying to use the bbedit tool as your EDITOR for some other
terminal based software?

If this is the later, I'm having deja vu. Didn't we just have a long
thread about this?

There is on specific feature in BBEdit that will automatically enforce
hard wrapping to a certain width. You are, of course, free to hard
wrap the text before you save and close the document.

It sounds like you want to automate this. If you are using the bbedit
tool as your editor, I'd suggest wrapping it in a script so you can
post-process the results.

Jim
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Lewis@Gmail
2008-04-21 15:10:35 UTC
Permalink
Post by Jim Correia
Post by ***@Gmail
Post by Jim Correia
Is there a way to specify the wrap margin when launching bbedit
from the cli? Is there a way to specify it as a HARD wrap? Is
there anyway to tell BBEdit to hard wrap a new document? All the
instances of 'wrap' in the manual are about soft wrap.
What specifically are you doing?
Editing files form the CLI that need to be wrapped at 72 characters.
I can do this with nano and vi (eg vim +'set tw=72'), but not in bbedit.
Or are you trying to use the bbedit tool as your EDITOR for some
other terminal based software?
This, mostly. But also when typing

bbedit newfile

I would like to be able to tell BBEdit that this file need to be hard
wrapped at a certain character width. With a newfile it is not that
huge an issue as I can usually just select the entire file and then
Text -> Hard Wrap.
Post by Jim Correia
If this is the later, I'm having deja vu. Didn't we just have a long
thread about this?
We talked about this peripherally as I am using bbedit as my editor
for slrn and I was trying to figure out how to post-process the file
to wrap the text. This avenue dead-ended though as everything I tried
either wrapped the headers as well, destroying the message, or re-
wrapped the quoted material incorrectly, messing up the quoting.

for example, if I select the entire post's body
<<<QUOTE
Post by Jim Correia
this
is a sample of some quoted text that is spaced out over a few lines
and is more than 72 characters
And here is my reply which is also over seventy-two characters in
length, but just.

QUOTE;

and then I rewrap it within BBEdit

I get:

<<<QUOTE
Post by Jim Correia
this > is a sample of some quoted text that is spaced out over a few
lines > and is more than 72 characters

And here is my reply which is also over seventy-two characters in
length, but just.

QUOTE;

So, I cannot simply select the entire body of the post to rewrap. I
only want the NEW content to be wrapped.

Anyway, I was hoping by rephrasing my question, someone might have a
different solution that hadn't occurred to them when I was talking
just about posting.
Post by Jim Correia
There is on specific feature in BBEdit that will automatically
enforce hard wrapping to a certain width. You are, of course, free
to hard wrap the text before you save and close the document.
Automatically? I find I can only hard wrap by selecting the text and
rewrapping it, and I have to be careful to only select the NEW text.
Post by Jim Correia
It sounds like you want to automate this. If you are using the
bbedit tool as your editor, I'd suggest wrapping it in a script so
you can post-process the results.
Well, yes, that SOUNDS like the best solution, but as you can see, the
issue of wrapping is not that cut-and-dried and this would take a
rather smart script.

Still, it seems rather a long way to go for something that, as far as
I can tell, every CLI editor has and would take simply having some way
to tell bbedit "use hard wrap instead of softwrap" since other than
that, bbedit/BBEdit behave exactly like I want.

I also tried using a text service (Format -> Reformat) which almost
works perfectly, but alas, strips the quote characters from the quoted
material
--
Yeah, Nick. Nick's the kinda guy you can trust. Nick's your buddy
Nick's the
kinda guy you drink beers with. The kinda guy that doesn' care if you
puke in his car. Nick.
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Jim Correia
2008-04-21 15:30:14 UTC
Permalink
Post by ***@Gmail
We talked about this peripherally as I am using bbedit as my editor
for slrn and I was trying to figure out how to post-process the file
to wrap the text. This avenue dead-ended though as everything I
tried either wrapped the headers as well, destroying the message, or
re-wrapped the quoted material incorrectly, messing up the quoting.
for example, if I select the entire post's body
<<<QUOTE
Post by Jim Correia
this
is a sample of some quoted text that is spaced out over a few lines
and is more than 72 characters
And here is my reply which is also over seventy-two characters in
length, but just.
QUOTE;
and then I rewrap it within BBEdit
Which command are you using?

Hard Wrap will just hard wrap everything.

Rewrap Quoted Text is quote sensitive (and will work on unquoted
blocks too.)
Post by ***@Gmail
So, I cannot simply select the entire body of the post to rewrap. I
only want the NEW content to be wrapped.
Another solution (which may not work since it will touch the original
content if it is longer than the wrap limit) is to select all then
choose "Add Line Breaks". This will put a hard line break at every
softwrap point. (Or you could be more selective about which lines get
this treatment by invoking a custom script.)

This is still a manual process unless you automate in some way beyond
the bare `bbedit` tool.
Post by ***@Gmail
Well, yes, that SOUNDS like the best solution, but as you can see,
the issue of wrapping is not that cut-and-dried and this would take
a rather smart script.
A simple implementation via script might be to just ignore lines that
begin with >. (That still may have undesirable effects on your
headers, so they might need another special case.)
Post by ***@Gmail
Still, it seems rather a long way to go for something that, as far
as I can tell, every CLI editor has and would take simply having
some way to tell bbedit "use hard wrap instead of softwrap" since
other than that, bbedit/BBEdit behave exactly like I want.
`bbedit` isn't a command line editor, just (extremely convenient) glue
to the GUI app, which doesn't have the feature that will automatically
hard-wrap new content as you type.

Jim
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Jim Correia
2008-04-21 15:33:51 UTC
Permalink
Post by Jim Correia
Post by ***@Gmail
QUOTE;
and then I rewrap it within BBEdit
Which command are you using?
Hard Wrap will just hard wrap everything.
Rewrap Quoted Text is quote sensitive (and will work on unquoted
blocks too.)
I should also add that if you rewrap the text as you go, BBEdit will
be smart about selections.

After you write a new paragraph, with the insertion point at the end
(or anywhere inside) of the paragraph, type (assuming default
keybindings) Command+Option+\ for Hard Wrap or Command+Option+' for
Rewrap Quoted, and BBEdit will expand the selection to the contained
paragraph and reflow it.

Jim
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Lewis@Gmail
2008-04-21 18:19:35 UTC
Permalink
Post by Jim Correia
I should also add that if you rewrap the text as you go, BBEdit will
be smart about selections.
I had learned that, at least, and was somewhat training myself to
command-opt-\ at the end of paragraphs.

Thanks for making me feel like an idiot though! No, seriously, thanks
for the pointer. That will make life much easier.
--
Yeah, Nick. Nick's the kinda guy you can trust. Nick's your buddy
Nick's the
kinda guy you drink beers with. The kinda guy that doesn' care if you
puke in his car. Nick.
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Lewis@Gmail
2008-04-21 18:17:41 UTC
Permalink
Post by Jim Correia
Post by ***@Gmail
and then I rewrap it within BBEdit
Rewrap Quoted Text is quote sensitive (and will work on unquoted
blocks too.)
Oh bloody hell!

(test test test)

Er.. Yeah. That seems to do most everything I want. Once again, I
have failed to notice a menu item in BBEdit that has likely been there
for years.

Now, a simple applescript that sets the insertion point at the first
blank line and then rewraps quoted text through to the end of the
file. That doesn't sound too hard. Then I can set it to the command
combo for wrap quoted text.
--
Yeah, Nick. Nick's the kinda guy you can trust. Nick's your buddy
Nick's the
kinda guy you drink beers with. The kinda guy that doesn' care if you
puke in his car. Nick.
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <***@barebones.com>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <bbedit-talk-***@barebones.com>
Loading...