PracticalVim Tip82 - yszheda/wiki GitHub Wiki

Tip 82: Count the Matches for the Current Pattern

Return to the top: <>

  • `n` flag: instead of replacing each match with the target, it simply counts the number of matches and then echoes the result below the command line.
  • By leaving the search field blank, we instruct Vim to use the current search pattern.
  • Because of the `n` flag, the replacement field is ignored anyway.
⚠️ **GitHub.com Fallback** ⚠️