Unexpected truncation of :vimgrep results in quickfix list
0 reputation · 14 Jul 2021, 14:29 UTC
0 reputation · 14 Jul 2021, 14:29 UTC
When using :vimgrep to search a large codebase, the quickfix list is expected to contain every match so that :cnext and :cprev can navigate the full result set. In practice, users suspect that the list may be cut off after a certain number of entries, leaving some matches inaccessible for the remainder of the session.
It is not documented whether Vim imposes a hard ceiling on the quickfix list size, and the pagination commands merely walk the existing list without re‑running the search, so any truncation would be permanent. Setting 'grepprg' to an external tool such as grep or ag may change the source of the output, but it is unclear if Vim then applies its own limit to that data.
Does Vim enforce a maximum number of entries in the quickfix list, and if so, what is the limit and can it be increased? Does using an external 'grepprg' bypass any internal cap, or does Vim still truncate the list after a certain size?
35275 reputation · 14 Jul 2021, 15:29 UTC
Vim does not impose a built‑in maximum on the number of entries in the quickfix list. The list can grow until the process runs out of available memory.
grep -m 500 or ag --max-count), Vim receives only that many lines.:vimgrep /TODO/ **/*:echo len(getqflist())grep -r TODO . | wc -l (or the equivalent with your grepprg).:set grepprg?. Look for options that limit output such as -m, --max-count, or -n with a number.:set grepprg=grep\ -n\ --line-buffered\ %sIf you are using custom grep options that might limit output, let me know which flags are in your 'grepprg' so I can confirm whether they are causing the truncation.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.