How do I load shell search output into a window-local location list?
Answer
:lgetexpr systemlist('rg --vimgrep TODO %') | lopen
Explanation
When you want search results tied to only the current window, use :lgetexpr instead of :cgetexpr. This gives you the same parser-driven workflow as quickfix, but isolates results so another split can keep its own independent list. It is especially useful during refactors where each window is focused on a different subsystem.
How it works
systemlist('rg --vimgrep TODO %')runs ripgrep and returns each match line as a Vim list item:lgetexprparses those lines usingerrorformatand stores entries in the current window's location list:lopenopens that list so you can step through with:lnextand:lprev
Because location lists are window-local, you avoid clobbering global quickfix state used by builds, tests, or another search session.
Example
src/service/user.ts:19:3: TODO validate email
src/service/user.ts:47:7: TODO normalize roles
After running the command, those matches appear in the current window's location list. In a second split, you can run a completely different :lgetexpr search and keep both result sets active at once.
:lnext
:lprev
:lclose
Tips
- Keep
:cgetexprfor shared, project-wide quickfix workflows; use:lgetexprfor per-window focus - If parsing looks wrong, tune
errorformatto match your command output - Use
%:pinstead of%if your tool needs absolute paths