Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Vim Insert (Capital) "I" Command

115 views
Skip to first unread message

maniacinthemailbox

unread,
Jun 6, 2010, 10:35:58 PM6/6/10
to
I have been a long time Vim user, but one issue that has always
perplexed me is inserting a line of text before a range of lines. I'm
not sure if this is within the scope of Vim or if a different program
would be more ideal (awk?) but here it is. I am trying to insert "sed
s^" in front of a range of lines (3-39). I tried typing (:3,39I "sed
s^") (without parentheses) but it returned with the error "The I
command is unknown". Could this be due to compatibility mode? Does
this work for anyone else? Are there any vi derivatives that have this
function? Thank you for any information!

Bastian Erdnuess

unread,
Jun 7, 2010, 12:55:58 AM6/7/10
to
maniacinthemailbox wrote:

'I' is not a command line command. It works as you expect only in
Visual Block mode. To do what you intended press

3G<Ctrl-v>39GI

in Normal mode (<Ctrl-v> is one unit). Now write "sed ^". It only
appears at the beginning of the 3rd line. When you press <ESC> now, it
will appear everywhere at the beginning of the lines in the given range.

Cheers,
Bastian

Mikolaj Machowski

unread,
Jun 7, 2010, 1:37:30 AM6/7/10
to
maniacinthemailbox scripsit:

I is Normal mode command, to use range in Ed mode:

:3,39s/^/sed s^/

m.

0 new messages