> In other text editors I've seen the feature where pressing some keyboard shortcut (e.g., CTRL+J) will join the current line with the next line. Multiple calls will "suck up" subsequent lines. I find this handy in a number of situations. Does TextWrangler have this feature, or something similar, or is there an easy way for me to script this?
From the way you describe what you want to do, it sounds like you could simply script changing the next return to a word space. I too recall having this function in an editor or two - Vantage I think, maybe BBEdit - but I get it now using the QuicKeys reformat function (Text > Text Tools > Reformat), which I've assigned to my old keycode for this, cmd-ctrl-`.
Roy McCoy
If the idea is to put together parts separated by one carriage return, "\r", you could use "remove line breaks" in the "text" menu (and assign a keyboard shortcut to it, mine is ctrl-\), the "inverse" operation is "hard wrap" or "add line breaks" in the same menu.
If there are two (or more) contiguous carriage returns, leaving blank lines in between, you could delete them (or forward delete them) one at a time (or use the replacement "\r+" -> "" or something similar).
Hope it helps,
Nestor
> If the idea is to put together parts separated by one carriage return, "\r", you could use "remove line breaks" in the "text" menu (and assign a keyboard shortcut to it, mine is ctrl-\),
Oh, so it *is* there in TextWrangler - good to know.
> the "inverse" operation is "hard wrap" or "add line breaks" in the same menu.
I've used Hard Wrap, also combined in macros - but I was unaware of Add Line Breaks, which looks really handy. With that, instead of having to try and guess or figure out how wide your text window is and maybe adjust it or the hard wrap setting, you can get the lines broken however they're displayed at whatever window width.
> If there are two (or more) contiguous carriage returns, leaving blank lines in between, you could delete them (or forward delete them) one at a time (or use the replacement "\r+" -> "" or something similar).
I have an InDesign script I use sometimes that changes multiple carriage returns to XXX, changes single returns to word spaces, and finally changes the XXX's back to returns. This gets rid of extra line spaces while conserving (unbroken) paragraphs.
Thanks,
Roy
Group: http://groups.google.com/group/textwrangler/topics
- How can I join two lines in TextWrangler? [4 Updates]
- shebang lines [1 Update]
Jonathan Gordon <javas...@kinobe.com> Nov 16 06:29PM -0800
In other text editors I've seen the feature where pressing some keyboard
shortcut (e.g., CTRL+J) will join the current line with the next line.
Multiple calls will "suck up" subsequent lines. I find this handy in a
number of situations. Does TextWrangler have this feature, or something
similar, or is there an easy way for me to script this?
There is a Services service (odd construction, I know) called "wordservice" that does many very handy things, and one of them, "Reformat", should do just what you're asking for.