My favorite text editor on Windows is UltraEdit, and it has a columnar editing mode which is useful surprisingly often.
I am pretty sure I understand how TextMate's columnar editing works (option-arrow to create column selection, then type). However, having a columnar mode makes the feature much more useful.
When in the columnar mode, any cursor movement stays in the mode, and shift-arrow does what you'd expect it to: shift-up/down keeps the same columns selected but adds/removes the next line while shift-left/right adds/removes the next column for all lines.
When you have one or more columns selected, typing replaces the contents with the character just pressed, but keeps the same number of columns. Typing with 0 selected columns enters that key on every row. Delete removes all the selected columns, yielding 0 selected columns. Paste enters the clipboard contents into the first row of the selected columns, though honestly, I'd prefer that it pasted to all selected rows.
I think the primary benefit of a columnar mode is the ease of keyboard selection of the column range.
Additionally, UltraEdit has a feature where you can analyze a delimited file and automagically convert it to a fixed width file, which lends itself to columnar editing. When done, you can then convert it back to a delimited format.
The two features work together to make it great for editing flat files of both fixed and delimited flavors.
I'm attaching a screenshot of the fixed scan dialog in ultraedit for illustration of the feature. It's not the best designed UI ever, but: x The current file is assumed to be delimited. x The scan button analyzes the current file's lines to try to determine the max length needed for each field based on the options selected (which are all settings except "Keep Delimiter" and "Field Widths"). x Based on this analysis, the Field Widths textbox is populated with each field's width. If you know the widths needed, you can skip the scan step and just enter your widths in the Field Widths box directly. x Once you're happy with the Field Widths values, you click Convert to translate it to fixed width. The "Keep Delimiter" option determines whether the original delimiters are stripped from the resulting fixed file.
The Convert To Delimiter dialog is much simpler (screenshot excluded); it just takes the last Field Widths used for conversion to fixed, and slaps on the given delimiter at those lengths.
===
Sorry for the length, but I think these are very useful features which could be implemented (with a better UI) in TextMate, and I'd be happy to see them included.
Cheers, Jeremy Dunck
On 21/07/2005, at 17.11, Jeremy Dunck wrote:
My favorite text editor on Windows is UltraEdit, and it has a columnar editing mode which is useful surprisingly often. [...] I think the primary benefit of a columnar mode is the ease of keyboard selection of the column range.
If I understand you correctly, the conceptual difference is that UE has a sticky columnar editing overlay, which you enable, do your editing task (and have the ability to extend the overlay), and then disable again, where TM makes the overlay more implicit and/or elusive (it's gone when the caret is moved outside the overlay, which automatically extend to encompass text inserted in column-typing mode).
For my editing tasks I definitely favor the implicit/elusive behavior, but I'll check out UE the next time I get the chance, to see if it inspires me -- based on your part about conversion, I imagine that for you the columnar editing is often a special mode you use for certain files, where for me, it's one of many editing tools (used for just one or two “edits”, and often I do a transformation on the column selection instead of entering edit mode).
Btw: TM does (for single line clips) paste on each line when in column-typing mode or when there's a column selection :)
Additionally, UltraEdit has a feature where you can analyze a delimited file and automagically convert it to a fixed width file, which lends itself to columnar editing. When done, you can then convert it back to a delimited format.
Could you send me an example of such file (you can send it privately)? I think this would help me better understand when you'd need this.
On 22 juil. 05, at 06:01, Allan Odgaard wrote:
For my editing tasks I definitely favor the implicit/elusive behavior, but I'll check out UE the next time I get the chance, to see if it inspires me
You may also want to check how SubEthaEdit does it then, I personnally find that it makes much more sense and is much easier to use than in TM.
Have a look at this 7 lines example where I want to insert some text in colum 7 of lines 2 to 6:
Block editing in TextMate:
Block editing in SubEthaEdit:
Now tell me which one is the more obvious, honestly. The TextMate way where you can barely see the column selection (did you even spot it ? :)) ? Or the SubEthaEdit way where all block edited lines are clearly highlighted and you know where the column is by simply looking at the position of the cursor (which got removed in the screenshot) ?
This is one of those case where all I can say is "this looks so wrong that there is probably something obvious that I miss, or simply don't get". So feel free to enlighten me ;)
There are two reasons why I still prefer SubEthaEdit over TM for most of my text editing tasks and that's one of them. The other one being the symbol popup which I'm pretty sure *will* make it to TM eventually, so I won't mention it. Oh, wait, I just did :)
PS: and while I'm at it, I also love the way SubEthaEdit displays the line numbers in the gutter using a slightly smaller font. Details, details... ;)
On 22/07/2005, at 9.49, Luc Heinrich wrote:
[...] This is one of those case where all I can say is "this looks so wrong that there is probably something obvious that I miss, or simply don't get". So feel free to enlighten me ;)
Yes, I think you're overlooking that TextMate supports column selections of arbitrary size, the 0-width version is just one size. Overtyping the selection is also only one of several things you can do with the selection, and you can do it no matter what type of selection or size it has.
For a more verbose version of the above: http://macromates.com:3000/ read/chapter/7
So I'm not really sure what you're advocating here -- you'd want TM to switch visual rendering of the selection when it's 0 columns wide and/or when you overtype it? that'd be rather weird...
On 22 juil. 05, at 10:31, Allan Odgaard wrote:
Yes, I think you're overlooking that TextMate supports column selections of arbitrary size, the 0-width version is just one size.
Right. The question is: is supporting column selections of arbitrary size really a good choice as opposed to SubEthaEdit's block editing ? Can you enumerate any advantage ?
I've already showed why I think that a 0-width column is a bad thing visually. Here are two more examples.
Consider this (not so) contrived text sample (with line numbers shown for convenience):
[1] foo ba baz [2] foo ba baz [3] # a comment line [4] foo ba baz [5] foo ba baz [6] # a comment line [7] foo ba baz [8] foo ba baz
The goal now is to: - add the 'r' at the end of each 'ba' to make 'bar'. - add 'qux' after each 'baz'.
With TextMate column selection: 1. create a 0-width column after 'ba' in lines 1-2 2. type 'r' 3. create another 0-width column after 'qux' in lines 1-2 4. type ' qux' 5. create a 0-width column after 'ba' in lines 4-5 6. type 'r' 7. create another 0-width column after 'qux' in lines 4-5 8. type ' qux' 9. create a 0-width column after 'ba' in lines 4-5 10. type 'r' 11. create another 0-width column after 'qux' in lines 4-5 12. type ' qux' 13. Done
With SubEthaEdit block editing: 1. create a non-contiguous block for lines 1-2, 4-5 and 7-8 (yes, that's possible) 2. move cursor after any 'ba'. 3. type 'r' 4. move cursor after any 'baz'. 5. type ' cux 6. Done
This shows two more things: A. In TextMate, if I want to make several transformations on multiple lines, I'll have to create a column selection for each transformations. B. In TextMate, if I want to make transformations on multiple non- contiguous lines, I'll have to repeat each of them for each blocks of contiguous lines.
Multiply the number of steps in A by the number of steps in B by the number of transformations, and you'll see how fast this can become tedious :)
No really, if you haven't already did, try the SubEditEdit block editing mode to see how it works, it will probably be a thousand times more explicit than my poor explanations... ;)
On 22/07/2005, at 13.23, Luc Heinrich wrote:
[1] foo ba baz [2] foo ba baz [3] # a comment line [4] foo ba baz [5] foo ba baz [6] # a comment line [7] foo ba baz [8] foo ba baz
The goal now is to:
- add the 'r' at the end of each 'ba' to make 'bar'.
- add 'qux' after each 'baz'.
With TextMate column selection: [... 13 steps...]
Although with 'Edit Each Line In Selection', and not using column mode, you can make this into 3 x mark, activate edit, edit r and edit qux instead.
-- Sune.
On 22/07/2005, at 13.23, Luc Heinrich wrote:
Right. The question is: is supporting column selections of arbitrary size really a good choice as opposed to SubEthaEdit's block editing ? Can you enumerate any advantage ?
Yes -- I use it on average probably daily. If you can't imagine why you'd do a column selection and delete it, replace it, transpose the lines, convert tabs to spaces, do a replace in selection, overtype it, toggle case of letters etc. then you probably edit other types of stuff than me.
I've already showed why I think that a 0-width column is a bad thing visually. Here are two more examples.
But you didn't say what to do instead. Isn't the caret then also bad visually?
Consider this (not so) contrived text sample (with line numbers shown for convenience):
Well, the data for which I use column selection very very rarely have lines in between, mostly it's data structures, bullet lists, or two or more partial identical lines, where I need to make the same change (s).
With TextMate column selection: [...] With SubEthaEdit block editing: [...]
Now, remove the comments to get what to me is the typical case, and you need to grab, drag, and click the mouse in SEE multiple times, do your change, and then leave the mode, where in TM you can place caret at line 1 before text, press option-shift down, tab option once, and you have the zero-width selection and can start typing (and when you're done, you just move along).
Multiply the number of steps in A by the number of steps in B by the number of transformations, and you'll see how fast this can become tedious :)
You can make up worst-case examples for almost any feature -- as mentioned, I use the feature daily, I have also tried block edit, it's not the same, and I wouldn't swap -- if anything, it could be an additional mode, but I don't think it's worth it (at least compared to what other editing features I have in mind :) ).
On 22 juil. 05, at 15:05, Allan Odgaard wrote:
Yes -- I use it on average probably daily. If you can't imagine why you'd do a column selection and delete it, replace it, transpose the lines, convert tabs to spaces, do a replace in selection, overtype it, toggle case of letters etc. then you probably edit other types of stuff than me.
I can totally imagine, and that's PRECISELY why I'm saying that TextMate's current implementation is crippled.
But you didn't say what to do instead. Isn't the caret then also bad visually?
I don't think so, the caret is still the caret you use in "normal" situation, it's just that since you're in block edit mode, things will also happen in other lines (which are highlighted).
Now, remove the comments to get what to me is the typical case, and you need to grab, drag, and click the mouse in SEE multiple times
No, that's not how it works. Have you TRIED it ?
On 22 juil. 05, at 16:54, Luc Heinrich wrote:
No, that's not how it works. Have you TRIED it ?
Btw, if this wasn't clear (that last comment might sound harsh) I am not trying to slam TextMate or demonstrate that it sucks or anything like this. I've probably been one of the earliest adopters and I happily payed the 39€ because Allan has proved to be very responsive and open to changes and new features proposals.
It's just that I want it to be perfect, you know. Now gimme this symbol popup and maybe I'll shut up on this block editing thingy :p
On Jul 22, 2005, at 6:20 PM, Luc Heinrich wrote:
Btw, if this wasn't clear (that last comment might sound harsh) I am not trying to slam TextMate or demonstrate that it sucks or anything like this. I've probably been one of the earliest adopters and I happily payed the 39€ because Allan has proved to be very responsive and open to changes and new features proposals.
It's just that I want it to be perfect, you know.
thanks for pointing that out but don't worry about it - I for one am with you on this one - I'd very much like SEE's column editing in TM. your example with the interspersed comments is not excotic at all for my kind of work.
just my $0.02,
best regards,
tom -- Tom Lazar http://tomster.org