Wow! A further contribution to a thread which ran in June 2004! Comment: Yes, that too is one way of doing it.
As with all such things, there are variants which some may prefer, according to taste. The main point, of course, is that it amounts to being able to see the vertically aligned input prior to formatting, a side-question which Jorgen Grahn had introduced into the thread as "a problem with tbl, IMHO". Ted. On 09-Aug-09 14:14:29, Ralph Corderoy wrote: > > Hi Ted, > >> What I sometimes do, when I feel the need for properly aligned visual >> layout, is to space out with a character not occuring elsewhere, and >> finally remove it. At a pinch TAB (^I) will do, though often this puts >> in too much space. I rarely need "~" in tables, so tend to fill with >> "~" (my usualy tab separator is "#"). Then, at the end, block the >> table (I use 'vim') and do a global delete. E.g. >> >> .TS >> tab(#); >> l l l l. >> Ed~~~~#James~#top~~~#bottom >> Albert#Fred~~#left~~#right >> Jim~~~#Wilf~~#back~~#front >> .TE >> >> becomes, after blocking the 3 lines and then ":s/\~//g" > > Why not use a space instead of `~' and do > > :s/ *#/#/g > > to remove all runs of spaces followed by a hash? > >> .TS >> tab(#); >> l l l l. >> Ed#James#top#bottom >> Albert#Fred#left#right >> Jim#Wilf#back#front >> .TE > > You may like to know that column(1) can be used to reverse the effect > should you need to edit it again, e.g. for the above in vim(1). > > # Move to the `Ed' line. > :,+2s/#/@#/g > # Move back to the `Ed' line. > 3!!column -s @ -t > > It prefixes each of the `#' with an `@', assuming that's also unused, > and then uses column(1) to turn each `@' into the run of spaces > required > to make each column line up, working out the widths required. The `#' > remain. Naturally, you can use visual blocks instead of counting > lines. > > .TS > tab(#); > l l l l. > Ed #James #top #bottom > Albert #Fred #left #right > Jim #Wilf #back #front > .TE > > It would be trivial to wrap the substitute and column into a little > script in ~/bin so you can run with with ! from vi. > > Cheers, > > > Ralph. > > > -------------------------------------------------------------------- E-Mail: (Ted Harding) <[email protected]> Fax-to-email: +44 (0)870 094 0861 Date: 09-Aug-09 Time: 16:09:37 ------------------------------ XFMail ------------------------------
