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.