Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search in all directories

I can't find out how to search in Vim in all directories with:

  • grep
  • ack
  • findstring
  • vimgrep

p.e. search "search-item" in all .txt files in c:\ and d:\ (including sub directories)

Can anyone help me?

like image 386
Reman Avatar asked Sep 07 '25 14:09

Reman


2 Answers

You can use grep as usually

:grep -R 'search-item' path1 path2

For more information see:

:h grep
like image 70
Ajnasz Avatar answered Sep 10 '25 03:09

Ajnasz


Following works for me

:vimgrep /<search>/ {c:,d:}/**/*.txt
like image 37
Lieven Keersmaekers Avatar answered Sep 10 '25 04:09

Lieven Keersmaekers