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

Re: Search() vs /

Expand Messages
  • Klaus Bosau
    ... Maybe one could use | ... fun Search() let pat = input( pat? ) exe norm ma/ . pat . | _^);^M if getline( . ) =~ ^); norm `a echo not found
    Message 1 of 3 , Jan 30, 2003
    View Source
    • 0 Attachment
      On Wed, 29 Jan 2003, David Fishburn wrote:

      > Vim 6.1.301 WinXP
      >
      > I have a file with the following:
      > CREATE TABLE customer (
      > id INT DEFAULT AUTOINCREMENT,
      > last_modified TIMESTAMP NULL,
      > first_name VARCHAR(30) NOT NULL,
      > last_name VARCHAR(60) NOT NULL,
      > balance NUMERIC(10,2),
      > PRIMARY KEY( id )
      > );
      >
      > I use search() to find the create table statement, which places my
      > cursor on that line.
      >
      > [find "PRIMARY KEY"]

      Maybe one could use '\|'...

      fun Search()
      let pat = input('pat? ')
      exe 'norm ma/' . pat . '\|\_^);^M'
      if getline('.') =~ '^);'
      norm `a
      echo 'not found'
      endif
      endfun

      nmap _s call Search()<Cr>

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