How do I keep project search results window-local with a location list?
Answer
:lvimgrep /TODO/j **/* | lopen
Explanation
When you are working in split-heavy sessions, global quickfix results can become noisy because every window shares the same list. :lvimgrep solves this by populating a location list, which is local to the current window. This gives you focused search results without disrupting other windows that may already be using quickfix for diagnostics or build errors.
How it works
:lvimgrepruns a Vim grep and stores matches in the current window's location list/TODO/is the search pattern (replace with your own regex)jtells Vim not to jump to the first match immediately**/*searches recursively through files under the working directory| lopenopens the location list window so you can inspect and navigate matches
Example
Suppose your project has TODO markers in multiple files and your quickfix list is already occupied by compiler output.
:lvimgrep /TODO/j **/* | lopen
Now this window gets its own result list. You can move through matches with location-list commands, while other windows keep their own context.
Tips
- Use
:lcloseto hide the window without clearing results - Use
:lwindowif you only want it to open when there are matches - Prefer this over quickfix when each split tracks a different investigation