How do I search only files in the argument list and inspect results in a location list?
Answer
:lvimgrep /{pattern}/j ## | lopen
Explanation
When you need to run focused searches across a curated set of files, the argument list is a strong scope boundary. Pairing it with :lvimgrep keeps results window-local, which avoids polluting the global quickfix list during parallel tasks. This is especially useful during refactors where each split has a different investigation context.
How it works
:lvimgrep /{pattern}/j ## | lopen
:lvimgrepruns Vim regex search and writes matches to the location list (not quickfix)/{pattern}/is your search regexjadds matches without jumping away from your current cursor position##expands to all files currently in the argument list| lopenopens the location list window immediately for review
Example
Suppose your argument list contains only files touched in a current change set:
api/auth.lua
api/session.lua
ui/login.lua
Running :lvimgrep /token\\|session/j ## | lopen gives a per-window hit list for those files only, rather than the entire project.
Tips
- Build the argument list first with commands like
:args **/*.luaor from shell expansion - Navigate matches with
:lnextand:lprev - Keep different location lists in different windows for separate search threads