On 2007-04-25, "Srinivas Rao. M" <[EMAIL PROTECTED]> wrote: > On Mon, 2007-04-23 at 21:11 -0700, Gary Johnson wrote: > > On 2007-04-24, [EMAIL PROTECTED] wrote: > > > Hi, > > > > > > A similiar problem I had was solved previously. Now > > > I got stuck in the "advanced version" of this. Suppose > > > I have the following text (:set list) : > > > > > > > > > ljdh $ > > > laskjdl $ > > > sdj $ > > > aslkdjldjlad$ > > > a $ > > > askdj $ > > > askdjlsd $ > > > aks $ > > > lkasjdsdjlllljadl $ > > > > > > and I want this with less plugins, keystrokes, function > > > definitions etc as possible.... > > > > > > ljdh = spacequest( vim, text );$ > > > laskjdl = spacequest( vim, text );$ > > > sdj = spacequest( vim, text );$ > > > aslkdjldjlad = spacequest( vim, text );$ > > > a = spacequest( vim, text );$ > > > askdj = spacequest( vim, text );$ > > > askdjlsd = spacequest( vim, text );$ > > > aks = spacequest( vim, text );$ > > > lkasjdsdjlllljadl = spacequest( vim, text );$ > > > > > > I (with set ve=all or set ve=block) to marked a column > > > with a visual block and tried "r" (which works "only" for > > > one character to be inserted) and R (which kills ALL my > > > text). > > > > > > How can I solve this problem ? > > > > This particular case of all the added text being the same is pretty > > easy to solve. Start the way you did before, by typing Ctrl-V and > > highlighting a column. Then instead of typing 'r' to replace a > > single character, type 's' to substitute the selected text with an > > arbitrarily-long string and follow the 's' with > > > > = spacequest( vim, text ); > > > > and finish by typing <Esc>. See > > > > :help visual-operators > > > > for more operations you can perform on visually-selected areas.
> Hi, > Do you have any (similar) solution for aligning each column of data. > What i want is to tabulate a chunk of data in to rows and columns. > > i.e i have text like this: > > (1.31 and 1.32) tool-ch$ > (1.3 and 1.5) tool-ch$ > (1.3 and 1.40) tool-ch$ > (1.301 and 1.401) tool-ch$ > (1.2 and 1.4) proje$ > > what i want is : > > (1.31 and 1.32) tool-ch$ > (1.3 and 1.5) tool-ch$ > (1.3 and 1.40) tool-ch$ > (1.301 and 1.401) tool-ch$ > (1.2 and 1.4) proje$ I don't have any solutions that are built into vim and are as simple as the one above. What I would do is install Dr. Chip's Align plugin, http://vim.sourceforge.net/scripts/script.php?script_id=294 Then highlight the rows to be aligned (using the V command), type :Align \ and hit Enter. When I did that, I got exactly the result you said you wanted. Note that a space follows that backslash; that is telling Align to use a single space as the character to align. Note also that that command will appear on the command line as :'<,'>Align \ because vim will automatically append "'<,'>" when you type a colon in visual mode. Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA