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

copy words matching pattern

Expand Messages
  • Gowri S
    Is there a direct way to copy all words matching a particular pattern? For E.g: I want a list of all words matching m_.* in the current file Of course one
    Message 1 of 4 , Feb 27, 2002
    • 0 Attachment
      Is there a direct way to copy all words matching a
      particular pattern?
      For E.g: I want a list of all words matching "m_.*" in the
      current file

      Of course one way to achieve it is do a g:/m_.*/call
      collect(getline(".", "m_.*"))
      where collect will find the words of that pattern and
      collate it.

      But hopefully there is an easier more direct way to achieve
      this?
    • vipin aravind
      how about this g: (m_ . S* ):execute normal yw | let collect = collect . @ vipin ... From: Gowri S To: Sent:
      Message 2 of 4 , Feb 27, 2002
      • 0 Attachment
        how about this
        g:\(m_\.\S*\):execute "normal" "yw" | let collect = collect . @"

        vipin
        ----- Original Message -----
        From: "Gowri S" <gowris@...>
        To: <vim@...>
        Sent: Thursday, February 28, 2002 10:43 AM
        Subject: copy words matching pattern


        > Is there a direct way to copy all words matching a
        > particular pattern?
        > For E.g: I want a list of all words matching "m_.*" in the
        > current file
        >
        > Of course one way to achieve it is do a g:/m_.*/call
        > collect(getline(".", "m_.*"))
        > where collect will find the words of that pattern and
        > collate it.
        >
        > But hopefully there is an easier more direct way to achieve
        > this?
        >
        >
      • Michael Geddes
        This is similar,and of course only get the first on each line - but that should be enough, no? let @a= |g /
        Message 3 of 4 , Feb 27, 2002
        • 0 Attachment
          This is similar,and of course only get the first on each line - but that
          should be enough, no?

          let @a=''|g /\<m_/ let @A=matchstr(getline('.'),'\<m_\k\+\>')."\n"
          or
          let collect=''| g /\<m_/ let
          collect=collect.matchstr(getline('.'),'\<m_\k\+\>')."\n"

          //.
          -----Original Message-----
          From: vipin aravind [mailto:vipin.aravind@...]
          Sent: Thursday, 28 February 2002 4:46 PM
          To: Gowri S; vim@...
          Subject: Re: copy words matching pattern


          how about this
          g:\(m_\.\S*\):execute "normal" "yw" | let collect = collect . @"

          vipin
          ----- Original Message -----
          From: "Gowri S" <gowris@...>
          To: <vim@...>
          Sent: Thursday, February 28, 2002 10:43 AM
          Subject: copy words matching pattern


          > Is there a direct way to copy all words matching a
          > particular pattern?
          > For E.g: I want a list of all words matching "m_.*" in the
          > current file
          >
          > Of course one way to achieve it is do a g:/m_.*/call
          > collect(getline(".", "m_.*"))
          > where collect will find the words of that pattern and
          > collate it.
          >
          > But hopefully there is an easier more direct way to achieve
          > this?
          >
          >
        • Benji Fisher
          See the Pippo() function in foo.vim, my file of example vim functions: http://vim.sourceforge.net/scripts/script.php?script_id=72 This takes care of multiple
          Message 4 of 4 , Feb 28, 2002
          • 0 Attachment
            See the Pippo() function in foo.vim, my file of example vim functions:
            http://vim.sourceforge.net/scripts/script.php?script_id=72
            This takes care of multiple matches in a single line.

            HTH --Benji Fisher

            Michael Geddes wrote:
            >
            > This is similar,and of course only get the first on each line - but that
            > should be enough, no?
            >
            > let @a=''|g /\<m_/ let @A=matchstr(getline('.'),'\<m_\k\+\>')."\n"
            > or
            > let collect=''| g /\<m_/ let
            > collect=collect.matchstr(getline('.'),'\<m_\k\+\>')."\n"
            >
            > //.
            > -----Original Message-----
            > From: vipin aravind [mailto:vipin.aravind@...]
            > Sent: Thursday, 28 February 2002 4:46 PM
            > To: Gowri S; vim@...
            > Subject: Re: copy words matching pattern
            >
            > how about this
            > g:\(m_\.\S*\):execute "normal" "yw" | let collect = collect . @"
            >
            > vipin
            > ----- Original Message -----
            > From: "Gowri S" <gowris@...>
            > To: <vim@...>
            > Sent: Thursday, February 28, 2002 10:43 AM
            > Subject: copy words matching pattern
            >
            > > Is there a direct way to copy all words matching a
            > > particular pattern?
            > > For E.g: I want a list of all words matching "m_.*" in the
            > > current file
            > >
            > > Of course one way to achieve it is do a g:/m_.*/call
            > > collect(getline(".", "m_.*"))
            > > where collect will find the words of that pattern and
            > > collate it.
            > >
            > > But hopefully there is an easier more direct way to achieve
            > > this?
            > >
            > >
          Your message has been successfully submitted and would be delivered to recipients shortly.