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

Re: select found patterns

Expand Messages
  • Klaus Bosau
    ... Put fun! G(pat) fun! F() let @A = submatch(0) . n | return submatch(0) endfun let @a = | exe %s/ . escape(a:pat, / ) . / =F()/g endfun in your
    Message 1 of 2 , Sep 8, 2003
    • 0 Attachment
      On Mon, 8 Sep 2003, Luiz Siqueira Neto wrote:

      > How can I yank all high light patterns found by (/) command?
      > Ex.
      >
      > text:
      > --
      > this is a text for example, and is to a stupid text.
      > is again and is again.
      >
      > --
      > search, yank and put will return this:
      > is is is is

      Put

      fun! G(pat)
      fun! F()
      let @A = submatch(0) . "\n" | return submatch(0)
      endfun
      let @a = '' | exe '%s/' . escape(a:pat,'/') . '/\=F()/g'
      endfun

      in your .vimrc-file and then type in ":call G('is')". Patterns found are
      stored in register "a". To insert its content into the document you're
      working on type "ap

      HTH

      KLaus
    Your message has been successfully submitted and would be delivered to recipients shortly.