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

Re: paste and wrap

Expand Messages
  • Antoine J. Mechelynck
    ... I m not sure. Maybe chek options whose names start with paste (:help paste or :help paste ) ... the usual name is Normal mode. ... after
    Message 1 of 5 , Oct 2, 2004
    • 0 Attachment
      Darren <darrenwhite@...> wrote:
      > hi
      > I have set wrapmaergin to 1 in my vimrc file and it work as I would
      > like but when
      > I paste in a big chunk text it does not wrap. Is there a way to make
      > it wrap?

      I'm not sure. Maybe chek options whose names start with 'paste' (:help
      'paste<Tab> or :help 'paste<Ctrl-D>)

      > Also whan in edit mode (is that what it's called(not insert mode))

      the usual name is Normal mode.

      > how do in insert a CR to split a line? Darren

      after cursor position: a<CR><Esc>
      before cursor position: i<CR><Esc>

      To open a new, empty line above or below current line (starting from Normal
      mode): O or o (followed by <Esc> if you don't want to stay in Insert mode).

      In a mapping, type it as above, angle brackets and all. From the keyboard,
      each <...> is one key. See :help <> and scroll both up and down.

      Regards,
      Tony.
    • Antony Scriven
      ... Normal mode. ... I use the following two maps. They search for preceding or following white space and replace it with a newline. (I got the idea from Eli
      Message 2 of 5 , Oct 2, 2004
      • 0 Attachment
        Darren White wrote:

        > [...]
        > Also whan in edit mode (is that what it's called(not
        > insert mode))

        Normal mode.

        > how do in insert a CR to split a line?

        I use the following two maps. They search for preceding or
        following white space and replace it with a newline. (I got
        the idea from Eli the Bearded, to give credit where it is
        due.)

        :map \, ?[ ^I]^Mr^M
        :map \. /[ ^I]^Mr^M

        But these are vi-style with what should be literal control
        characters. In vim's idiom they would be:.

        :map <leader>, ?\s<CR>r<CR>
        :map <leader>. /\s<CR>r<CR>

        If you don't want these maps to affect your search history
        you could use the substitute() function in a script. But
        that's getting more complicated. I guess you could also make
        sure that whitespace preceding or following that which is
        found could also be removed:

        :map <leader>, ?\s<CR>:s/\s*\%#\s*/\r/<CR>
        :map <leader>. /\s<CR>:s/\s*\%#\s*/\r/<CR>

        But that means autoindent won't have any effect. So you
        could then do:

        :map <leader>, ?\s<CR>a<CR><Esc>:-s/\s*$//<CR>+
        :map <leader>. /\s<CR>a<CR><Esc>:-s/\s*$//<CR>+

        To preserve autoindent, even if the cursor is in the middle
        of whitespace, you could try (man, you could go on forever
        with this!):

        :map <leader>, ?\s<CR>?\S<CR>/\S<CR>i<CR><Esc>:-s/\s*$//<CR>+
        :map <leader>. /\s<CR>/\S<CR>i<CR><Esc>:-s/\s*$//<CR>+

        I think I like this one best, thanks! :-)

        Bear in mind that these maps will allow the cursor to cross
        line boundaries while you may prefer the search to only
        occur in the current line. You could fix that by using
        techniques specified at :help \%l. I think I'll stop now.

        Antony
      • Darren
        Hello, thanks for the help. I find it quite scary at just how much vim can do. I haven t got any of the :map commands to work yet, in fact I don t even know
        Message 3 of 5 , Oct 4, 2004
        • 0 Attachment
          Hello, thanks for the help. I find it quite scary at just how much vim can do. I haven't got any of the :map commands to work yet, in fact I don't even know what they are but now I have an idea of what to type after :help.
          Regards Darren






          _______________________________________________
          No banners. No pop-ups. No kidding.
          Make My Way your home on the Web - http://www.myway.com
        Your message has been successfully submitted and would be delivered to recipients shortly.