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

22982Re: Finding empty methods

Expand Messages
  • Kalle Bjorklid
    Nov 1, 2001
      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 this
      > 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 the
      > 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(".") . ': ' . getline(".")

      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