On 2006-05-31, Matthias Pitzl <[EMAIL PROTECTED]> wrote:
> Tim Chase wrote:
> > > Perhaps this is a simple question but i'm a bit confused.
> > > If i mark several lines with shift+v and then use shift+i
> > > to insert in front of the line, the text entered is just
> > > placed in front of the first marked line. How can i easily
> > > add text to all marked lines?
> >
> > It sounds like you're trying to do something allowed by
> > blockwise visual mode from within linewise visual mode. As
> > you've found, it doesn't work in linewise. :)
> >
> > You can either select the range in blockwise mode (using
> > ^V), or you can use an ex command.
> >
> > To learn more about the blockwise functionality, you can
> > read at
> >
> > :help blockwise-operators
> >
> > If you want to insert text at the beginning of a range of
> > lines, you can use
> >
> > :'<,'>s/^/text to insert
> >
> > If you have disjoint lines that can be found by a regexp,
> > you can use
> >
> > :g/regexp/s/^/text to insert
> >
> > Often, for me, this "text to insert" is a "comment to end
> > of line" specifier such as a "#" or "//".
> >
> > Just a few ideas,
> Thank you for the fast answer Tim :)
> I'll take a look onto these help pages. The possibility with s/.../.../
> i knew but i thought there has to be something easier ;)
There is. You were close with your first try; you just missed a
step. Mark the lines with shift+v, then type ctrl+v to change from
linewise to blockwise, then type shift+i and type your text. When
you then type escape, each line will have your text inserted in
front of it.
Gary
--
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
| Spokane, Washington, USA