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

22975Re: Finding empty methods

Expand Messages
  • Preben Guldberg
    Nov 1, 2001
      Thus wrote Scott LaBounty (slabounty@...) on [011101]:
      > 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?

      Just a rough idea:

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

      Or differently (expand it as you like)

      fun EmptyMethodLines()
      let str = ''
      g/{\_s\+}/let str = str . ' ' . line('.')
      if str != ''
      echo bufnr('%') . ': ' . expand('%') . '"' . "\t" . str
      endif
      endfun

      and then do

      :bufdo call EmptyMethodLines()

      Peppe
      --
      "Before you criticize someone, walk
      Preben "Peppe" Guldberg __/-\__ a mile in his shoes. That way, if
      c928400@... (o o) he gets angry, he'll be a mile away
      ----------------------oOOo (_) oOOo-- - and barefoot." --Sarah Jackson
    • Show all 7 messages in this topic