vimgrep on files in 'path'

27 views
Skip to first unread message

Arun

unread,
Dec 18, 2023, 2:27:50 PM12/18/23
to vim...@googlegroups.com
Hi there,

I wonder if there is any "grep" like counterpart for the ":find" command in vim. Today, ":find" helps one find any file in the 'path'. It would be nice to perform a search for a pattern in the files reachable via 'path'. I could then invoke, say,
    :findgrep /mypattern/ **/*def.h

..to grep for "mypattern" in files reachable via 'path' that ends in "def.h".

I tried to script it by passing the filenames to ":vimgrep" using:
    :exe 'vim/mypattern/'. join(getcompletion('**/*def.h', 'file_in_path'), " ")

..but getcompletion() sometimes does not give me the full path leading to errors.

Regards,
-Arun

Tristan Kapous

unread,
Dec 18, 2023, 2:34:15 PM12/18/23
to vim...@googlegroups.com
Hi!

You could use the arglist for this.
I'm not sure how to set it from a path but I think you'll find a way to do it.

Once your arglist is set, use `vimgrep /pattern/ ##` to grep the files in the arglist.

Regards,
Tris'
-------- Original Message --------
--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAJUkyiFTzLR%3D-OWnBF-MXaB%2B451H8%3DJJ6ojsLJVmgACZMOg6jw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages