Hi,
I was wondering if there's an easy to to prefix or suffix selected lines with a string.
Anyone who has used BBEdit will know what I am taking about.
I assume there is a way to do this, but I was hoping to avoid regular expressions other overly complex gyrations.
Thanks in advance.
Look at column selection/typing: http://macromates.com/textmate/manual/ working_with_text#column_selections
On 9 Mar 2007, at 18:26, smarks.other wrote:
Hi,
I was wondering if there's an easy to to prefix or suffix selected lines with a string.
Anyone who has used BBEdit will know what I am taking about.
I assume there is a way to do this, but I was hoping to avoid regular expressions other overly complex gyrations.
Thanks in advance.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Hi,
Look at column selection/typing: http://macromates.com/textmate/manual/ working_with_text#column_selections
On 9 Mar 2007, at 18:26, smarks.other wrote:
Hi,
I was wondering if there's an easy to to prefix or suffix selected lines with a string.
Anyone who has used BBEdit will know what I am taking about.
I assume there is a way to do this, but I was hoping to avoid regular expressions other overly complex gyrations.
While the aforementioned column selection will do the trick for the prefixing, suffixing may be tricker since the lines may not be equally long.
To deal with that, you can highlight the lines you want to suffix and hit cmd-opt-a and start typing away.
Btw, the cmd-opt-a is the shortcut to "Text > Edit Each Line in Selection"
Hope that helps, -steve
Thanks, I will give this a try. I haven't parsed the column_selections fully yet, but at first blush I think I was hoping for something dead simple. Maybe it is simple, with the docs making it harder than it looks. (Before I posted the question, I did start reading this section from the online help...)
Anyway, I will give both approaches some study.
Thanks again.
Spencer
On Mar 9, 2007, at 2:02 PM, Steve Lianoglou wrote:
Hi,
Look at column selection/typing: http://macromates.com/textmate/manual/ working_with_text#column_selections
On 9 Mar 2007, at 18:26, smarks.other wrote:
Hi,
I was wondering if there's an easy to to prefix or suffix selected lines with a string.
Anyone who has used BBEdit will know what I am taking about.
I assume there is a way to do this, but I was hoping to avoid regular expressions other overly complex gyrations.
While the aforementioned column selection will do the trick for the prefixing, suffixing may be tricker since the lines may not be equally long.
To deal with that, you can highlight the lines you want to suffix and hit cmd-opt-a and start typing away.
Btw, the cmd-opt-a is the shortcut to "Text > Edit Each Line in Selection"
Hope that helps, -steve
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Hi,
Thanks, I will give this a try. I haven't parsed the column_selections fully yet, but at first blush I think I was hoping for something dead simple. Maybe it is simple, with the docs making it harder than it looks. (Before I posted the question, I did start reading this section from the online help...)
Column selection is dead simple and you'll wonder how you've lived w/ o it for so long.
Just try to select a block of text across multipe lines. Once you have it selected (and let go of the mouse), just hit "option" and see what happens.
Alternatively, hold the option key down then click and select text across multiple lines, you'll pick it up right quick.
Enjoy, -steve
Thanks. That is as easy I hopped. I was able to follow these instructions better than those in the manual. Thanks again for your patience and excellent explanation.
On Mar 9, 2007, at 2:22 PM, Steve Lianoglou wrote:
Hi,
Thanks, I will give this a try. I haven't parsed the column_selections fully yet, but at first blush I think I was hoping for something dead simple. Maybe it is simple, with the docs making it harder than it looks. (Before I posted the question, I did start reading this section from the online help...)
Column selection is dead simple and you'll wonder how you've lived w/o it for so long.
Just try to select a block of text across multipe lines. Once you have it selected (and let go of the mouse), just hit "option" and see what happens.
Alternatively, hold the option key down then click and select text across multiple lines, you'll pick it up right quick.
Enjoy, -steve
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Mar 9, 2007, at 2:09 PM, smarks.other wrote:
Thanks, I will give this a try. I haven't parsed the column_selections fully yet, but at first blush I think I was hoping for something dead simple. Maybe it is simple, with the docs making it harder than it looks. (Before I posted the question, I did start reading this section from the online help...)
Anyway, I will give both approaches some study.
It is dead simple and very powerful. You might want to take a look at this screencast, which covers column selections along with other things:
http://macromates.com/screencast/math_and_column_selections.mov
-dan
Well, I tried the example for prefixing line by column and basically after several tries couldn't get it to work. I don't think I could select the 0 length column.
I was really hoping the such a feature prefix lines would be a non brainer, but I guess it isn't.
Suffixing lines work pretty easily however.
I wonder how much work would be involved to write a bundle that offered this functionality. I suspect too much or some one would have done it already.
Thanks again for the replies.
On Mar 9, 2007, at 2:02 PM, Steve Lianoglou wrote:
Hi,
Look at column selection/typing: http://macromates.com/textmate/manual/ working_with_text#column_selections
On 9 Mar 2007, at 18:26, smarks.other wrote:
Hi,
I was wondering if there's an easy to to prefix or suffix selected lines with a string.
Anyone who has used BBEdit will know what I am taking about.
I assume there is a way to do this, but I was hoping to avoid regular expressions other overly complex gyrations.
While the aforementioned column selection will do the trick for the prefixing, suffixing may be tricker since the lines may not be equally long.
To deal with that, you can highlight the lines you want to suffix and hit cmd-opt-a and start typing away.
Btw, the cmd-opt-a is the shortcut to "Text > Edit Each Line in Selection"
Hope that helps, -steve
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Fri, 9 Mar 2007, smarks.other wrote:
Well, I tried the example for prefixing line by column and basically after several tries couldn't get it to work. I don't think I could select the 0 length column.
To do this, you need to select all but the last line that you want to prefix and hit option. This will allow you to insert before all of the lines. For example, say you have:
line a line b line c
and you want to insert something before each line, then select the first two lines in their entirety (here capitals represent selected text, and ____ represent the selection encompassing the whitespace at the end of a line (including the newline). You should then selet the text as follows:
LINE A____ LINE B____ line c
Now it option, and you'll get a zero width column selected before all three lines:
|line a |line b |line c
Type your prefix and see what happens:
prefix--line a prefix--line b prefix--line c
It's really more simple than it sounds.
William D. Neumann
---
"There's just so many extra children, we could just feed the children to these tigers. We don't need them, we're not doing anything with them.
Tigers are noble and sleek; children are loud and messy."
-- Neko Case
Life is unfair. Kill yourself or get over it. -- Black Box Recorder
Hi,
Well, I tried the example for prefixing line by column and basically after several tries couldn't get it to work. I don't think I could select the 0 length column.
You can do it, either with the mouse or just the keyboard.
Using the keyboard to prefix three lines: --------------------------------------------------
Move the caret to the beginning of a line. Hold shift and press down arrow twice. Hit option once (to toggle between "normal" and "column" select).
You now have a 0-length selection at the start of the line that spans three lines.
Note that doing it in this way added a +1 line of column select -- something you'll have to remember is all.
Using the mouse to prefix three lines: -----------------------------------------------
Hold option down. Move the mouse to the beginning of the first line you want to prefix. Click and drag *straight* down to cross the three lines (don't pull the mouse right to make a box). Let go of mouse. Let go of option.
--> zero-width column select at the start of the three lines.
Just start typing and see.
I wonder how much work would be involved to write a bundle that offered this functionality. I suspect too much or some one would have done it already.
It's not that, it's just not necessary, really.
Give it another go :-)
-steve
On 9. Mar 2007, at 20:26, smarks.other wrote:
[...] I was really hoping the such a feature prefix lines would be a non brainer, but I guess it isn't.
Well, I know you said no regexps, but it really is dead simple, enable the regexp checkbox and then:
Find: .+ Replace: «prefix»$0«suffix»
Now hit “Replace All” or hold ⌥ and use the “in Selection”.
[...] I wonder how much work would be involved to write a bundle that offered this functionality. I suspect too much or some one would have done it already.
Five minutes to make a command that encapsulates the above regexp replace (using Dialog.request_string for the prefix/suffix), but spending five minutes learning about regexps would be a better investment of time ;)
Hi,
On Mar 9, 2007, at 8:11 PM, Allan Odgaard wrote:
On 9. Mar 2007, at 20:26, smarks.other wrote:
[...] I was really hoping the such a feature prefix lines would be a non brainer, but I guess it isn't.
Well, I know you said no regexps, but it really is dead simple, enable the regexp checkbox and then:
Find: .+
Replace: «prefix»$0«suffix»
Interesting. i've always uses Find: ^ or $ and Replace: prefix or suffix (respectively) myself.
Best regards,