Loading ...
Sorry, an error occurred while loading the content.
 

Re: How to add two lines in vim?

Expand Messages
  • Marvin Renich
    ... Actually, the trailing i is only needed if you want to end up in insert mode, and is not part of the command that inserts multiple lines. Note that any
    Message 1 of 8 , Jan 20, 2013
      * Bee <forth@...> [130120 18:24]:
      >
      >
      > On Jan 20, 3:13 pm, Bee <fo...@...> wrote:
      > > On Jan 20, 2:52 pm, Peng Yu <pengyu...@...> wrote:
      > >
      > > > Hi,
      > >
      > > > O can only add one lines. I'm wondering if there is a built in command to add two lines at a time in vim. Does anybody know?
      > >
      > > > Thanks,
      > > > Peng
      > >
      > > If you do 2O<return><esc> you will have two lines
      > > --OR--
      > > try 22O<return><esc> and you will have 22 new lines
      > >
      > > Bill
      >
      > Correction:
      >
      > 2O<esc>i
      > --OR--
      > 22O<esc>i

      Actually, the trailing i is only needed if you want to end up in insert
      mode, and is not part of the command that inserts multiple lines.

      Note that any text inserted as part of the O or o command gets inserted
      multiple times, as well. So that 5OHello<esc> will insert the line
      «Hello» five times.

      The delay between the <esc> and inserting the repetitions of the text
      only occurs in terminal vim, not gvim or macvim. It is a consequence of
      the keyboard handling. Terminal vim must wait a little bit to see if
      the <esc> is part of a terminal escape sequence for keys like the arrow
      keys or function keys.

      HTH...Marvin

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.