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

treat new line as space while searching

Expand Messages
  • Kamaraju Kusumanchi
    Let s say I have file with 2 lines, whose contents are word1 word2 word3 word4 Now I want to treat new line character as a space character just for searching
    Message 1 of 5 , Dec 27, 2006
    • 0 Attachment
      Let's say I have file with 2 lines, whose contents are

      word1 word2
      word3 word4

      Now I want to treat new line character as a space character just for searching
      purposes. So that I can search for "word2 word3" and a match will be found.

      Is this possible? Any extensions which do this?

      thanks
      raju
      --
      Kamaraju S Kusumanchi
      http://www.people.cornell.edu/pages/kk288/
      http://malayamaarutham.blogspot.com/

      ----------------------------------------------------------------------
      Click for free info on accredited degrees and make $150K/ year
      http://tags.bluebottle.com/fc/KCuXzzTdjAXH5OgYoRgETfYrx1AAA6/
    • Niels Bo Andersen
      ... You could use /word2 _s +word3 This will search for word2 followed by one or more whitespace or end-of-line characters followed by word3. See :help / _
      Message 2 of 5 , Dec 27, 2006
      • 0 Attachment
        Kamaraju Kusumanchi wrote:
        > Let's say I have file with 2 lines, whose contents are
        >
        > word1 word2
        > word3 word4
        >
        > Now I want to treat new line character as a space character just for searching
        > purposes. So that I can search for "word2 word3" and a match will be found.
        >
        > Is this possible? Any extensions which do this
        You could use

        /word2\_s\+word3

        This will search for word2 followed by one or more whitespace or
        end-of-line characters followed by word3.

        See :help /\_


        /Niels
      • jose isaias cabrera
        I don t think you need the +. Just /word2 _s word3 is enough... ... From: Niels Bo Andersen To: Kamaraju Kusumanchi
        Message 3 of 5 , Dec 27, 2006
        • 0 Attachment
          I don't think you need the +. Just

          /word2\_s\word3

          is enough...

          ----- Original Message -----
          From: "Niels Bo Andersen" <niels@...>
          To: "Kamaraju Kusumanchi" <kamaraju@...>
          Cc: <vim@...>
          Sent: Wednesday, December 27, 2006 5:45 PM
          Subject: Re: treat new line as space while searching


          > Kamaraju Kusumanchi wrote:
          >> Let's say I have file with 2 lines, whose contents are
          >>
          >> word1 word2
          >> word3 word4
          >>
          >> Now I want to treat new line character as a space character just for
          >> searching purposes. So that I can search for "word2 word3" and a match
          >> will be found.
          >>
          >> Is this possible? Any extensions which do this
          > You could use
          >
          > /word2\_s\+word3
          >
          > This will search for word2 followed by one or more whitespace or
          > end-of-line characters followed by word3.
          >
          > See :help /\_
          >
          >
          > /Niels
        • Niels Bo Andersen
          ... In that case, it would be /word2 _sword3 But then you would only find the matches with exactly one whitespace or one end-of-line character between the
          Message 4 of 5 , Dec 27, 2006
          • 0 Attachment
            jose isaias cabrera wrote:
            > I don't think you need the +. Just
            >
            > /word2\_s\word3
            >
            > is enough...
            In that case, it would be

            /word2\_sword3

            But then you would only find the matches with exactly one whitespace or
            one end-of-line character between the words. It would not work with
            indented text or if there were a space before the end-of-line.


            /Niels
          • jose isaias cabrera
            indeed... ... From: Niels Bo Andersen To: jose isaias cabrera Cc: Kamaraju Kusumanchi
            Message 5 of 5 , Dec 27, 2006
            • 0 Attachment
              indeed...

              ----- Original Message -----
              From: "Niels Bo Andersen" <niels@...>
              To: "jose isaias cabrera" <cabrera@...>
              Cc: "Kamaraju Kusumanchi" <kamaraju@...>; <vim@...>
              Sent: Wednesday, December 27, 2006 7:04 PM
              Subject: Re: treat new line as space while searching


              > jose isaias cabrera wrote:
              >> I don't think you need the +. Just
              >>
              >> /word2\_s\word3
              >>
              >> is enough...
              > In that case, it would be
              >
              > /word2\_sword3
              >
              > But then you would only find the matches with exactly one whitespace or
              > one end-of-line character between the words. It would not work with
              > indented text or if there were a space before the end-of-line.
              >
              >
              > /Niels
            Your message has been successfully submitted and would be delivered to recipients shortly.