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

Re: Plain text search45

Expand Messages
  • Antony Scriven
    ... I ve used the same technique before without problems: fun Literal(string) return V . escape(a:string, ) endfun ... but not with path names. Antony
    Message 1 of 3 , Nov 2, 2004
    • 0 Attachment
      Steve Hall wrote:

      > Can Vim to do a true plain text search? I'm particularly
      > thinking of an instance where all characters are taken
      > literally. I know about :set nomagic and \V, but there is
      > still the possibility (like Windows UNC paths) when a
      > user is looking to find double backslashes and expects to
      > find them when entering them as such.
      >
      > In the past, I created a dialog that took all inputs as
      > literals, escaped the backslashes and used \V. This
      > seemed a little hairy, being a substitution on a
      > substitution, but it theoretically should work, right?

      I've used the same technique before without problems:

      fun Literal(string)
      return '\V' . escape(a:string, '\')
      endfun

      ... but not with path names.

      Antony
    • Hari Krishna Dara
      ... Yes, I often use this technique too. With very nomagic mode only backslashes are special, so if the input string is to be treated as a literal string,
      Message 2 of 3 , Nov 2, 2004
      • 0 Attachment
        On Tue, 2 Nov 2004 at 11:31am, Antony Scriven wrote:

        > Steve Hall wrote:
        >
        > > Can Vim to do a true plain text search? I'm particularly
        > > thinking of an instance where all characters are taken
        > > literally. I know about :set nomagic and \V, but there is
        > > still the possibility (like Windows UNC paths) when a
        > > user is looking to find double backslashes and expects to
        > > find them when entering them as such.
        > >
        > > In the past, I created a dialog that took all inputs as
        > > literals, escaped the backslashes and used \V. This
        > > seemed a little hairy, being a substitution on a
        > > substitution, but it theoretically should work, right?
        >
        > I've used the same technique before without problems:
        >
        > fun Literal(string)
        > return '\V' . escape(a:string, '\')
        > endfun
        >
        > ... but not with path names.
        >
        > Antony
        >

        Yes, I often use this technique too. With 'very nomagic' mode only
        backslashes are special, so if the input string is to be treated as a
        literal string, then just double the backslashes in them. This is
        reliable.

        --
        HTH,
        Hari



        __________________________________
        Do you Yahoo!?
        Check out the new Yahoo! Front Page.
        www.yahoo.com
      Your message has been successfully submitted and would be delivered to recipients shortly.