On Linux, I sometimes see a list of all the lines which match a term with this handy command:
:! grep -n "term" %
However, I am now stuck on a Windows XP SP3 machine which lacks grep! Is there a way to get this list from within VIM itself, or using some other Windows tool via :!
?
Thanks.
Best Answer
Use
:g
.(Trivia: grep was named after the same
g/re/p
command in theed
editor, where re stands for "regular expression". Thep
suffix is optional, and is an abbrev for:print
.)To also display line numbers, either add
:nu
:or just enable
'number'
with:set number
.As an alternative to
grep
, Windows comes with toolsfind
andfindstr
that have the same basic functions.