Using Vim, how do you use a variable to store count of patterns found?

前端 未结 2 722
孤独总比滥情好
孤独总比滥情好 2020-12-10 19:07

This question was helpful for getting a count of a certain pattern in Vim, but it would be useful to me to store the count and sum the results so I can echo a concise summar

2条回答
  •  攒了一身酷
    2020-12-10 19:32

    I think that answer above is hard to understand and more pretty way to use external command grep like this:

    :let found=0
    :bufdo let found=found+(system('grep "

    " '.expand('%:p') . '| wc -l')) :echo found

提交回复
热议问题