How do I search a project but keep results window-local using the location list instead of quickfix?
Answer
:lvimgrep /TODO/j **/* | lopen\<CR>
Explanation
When you are working in multiple windows, quickfix can become noisy because it is shared globally across the editor session. :lvimgrep gives you a window-local alternative: the location list. This is a strong fit for focused refactors where each window tracks a different task, such as one list for TODO cleanup and another for API deprecations.
How it works
:lvimgrep /TODO/j **/* | lopen
:lvimgreprunsvimgrepbut stores matches in the location list for the current window/TODO/is the search pattern (replace with your own regex)jkeeps searching even if a file has no match**/*expands recursively through files (subject to your shell and Vim settings)| lopenopens the location-list window immediately so you can jump through results
Example
Suppose your project contains TODO markers spread across services and tests. Running :lvimgrep /TODO/j **/* | lopen in one window creates a local result set there. In another window, you can run a different :lvimgrep query without overwriting the first list.
window A loclist: TODO cleanup
window B loclist: deprecated API calls
Tips
- Use
:lnext,:lprev, and:llto navigate location-list results quickly - Use
:lwindowinstead of:lopenif you only want the list window when there are matches - For very large repos, narrow the file glob to a subtree (for example
src/**/*) to keep searches fast