Hello All,
I'm new to TextMate, moving over from BBEdit. I'm still exploring the application, but have already purchased a license, as it really "feels right."
First question relates to something I frequently did in BBEdit -- "Process All Lines", where I might prefix and suffix each line in a selection. Is there a way to do this in TextMate?
(I've seen there's an "Edit Each Line in Selection" menu item in TextMate, but I can't figure out what it does, or how to use it.)
Many thanks in advance.
-- Matt Henderson matt.henderson@gmail.com (personal) | matt@makalumedia.com (work) http://matt.makalumedia.com
On 17/11/2005, at 18:47, Matt Henderson wrote:
First question relates to something I frequently did in BBEdit -- "Process All Lines", where I might prefix and suffix each line in a selection. Is there a way to do this in TextMate?
When you want to only prefix something, you can use column typing.
This is basically making a (often zero width) column selection and then start typing. An easy way to do this is to: 1) place caret in front of the first line you want to prefix 2) hold shift and move arrow down till you're at the last line (should select them) 3) click and release the option modifier once, which toggles the selection to column mode 4) start typing (and what you do, is then mirrored on each line).
To make this even faster, you can use option (shift) arrow up/down to move up/down a “column”.
To suffix the lines, you would use the Edit Lines in Selection, this is done by selecting all the lines affected, and selecting the action -- this will place the caret last on the first line, and what you do there, will be mirrored, just like with column typing, but this works for when the insertion point isn't at the same column for each line.
Another approach is to select your lines and then do a simple regexp replace in selection (cmd-F, enable regexp, and ensure the Replace All Scope is set to Selection), this would be something like:
Find: ^.*$ Replace: «prefix»$0«suffix»
Here ^.*$ matches a line, and $0 refers to the entire line (in the replacement string).
On 17 Nov 2005, at 18:21, Allan Odgaard wrote:
- click and release the option modifier once, which toggles the
selection to column mode
See, that's what I love about this mailing list: you learn something new and useful every day. :-) I'd always been reaching for the mouse to do column-mode selections until now.