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

22985RE: Finding empty methods

Expand Messages
  • Scott LaBounty
    Nov 1, 2001
      Thanks to you both Kelle and Preben it works great!

      Preben, I think you meant:
      bufdo echo '=== '.bufnr('%').': '.expand('%').' ===' | g/{\_s\+}/#

      and not:

      bufdo echo '=== '.bufnr('%').': '.expand('%').' ===' | g/{\s_\+}/#

      i.e. \_s and not \s_

      Scott LaBounty
      Netaphor Software, Inc.

      -----Original Message-----
      From: Kalle Bjorklid [mailto:bjorklid@...]
      Sent: Thursday, November 01, 2001 1:24 PM
      To: Scott LaBounty
      Cc: Vim (E-mail)
      Subject: Re: Finding empty methods

      On Thu, 1 Nov 2001, Scott LaBounty wrote:

      > I'm trying to find empty methods in vim using:
      > /{\_s\+}
      > to search. What I would like is functionality similar to the :grep but
      > uses grep itself which doesn't understand the \_s notation for searching
      > across multiple lines. I tried using bufdo and it does go through all of
      > files but I can't get a list of where it found the empty methods at. Any
      > ideas?

      I came up with this:
      :bufdo :g/).*\_s*{\_s*}/echo bufname(".") . ' ' . line(".") . ': ' .

      the ').*\_s*' is needed because only the first line is echoed, and the '{'
      might not be on the same line with the declaration. And the '.*' is there
      to allow the 'throws...' stuff in Java (which can be on several lines, of
      course, but I'm too tired to think how to do it right :-).

      "Kalle" Karl-Mikael Bjorklid
      E-Mail: bjorklid@...
      Work-related: kalle.bjorklid@...
      WWW: www.cc.jyu.fi/~bjorklid/
    • Show all 7 messages in this topic