以下是關於quickfix列表和位置列表的文檔。但我不確定實際上有什麼不同。下圖顯示了位置列表和quickfix列表中的相同內容。我什麼時候在vimgrep和lvimgrep中使用一個或另一個。vim中位置列表和quickfix列表有什麼區別
In Vim the quickfix commands are used more generally to find a list of positions
in files.For example, |:vimgrep| finds pattern matches. You can use the positions
in a script with the |getqflist()| function. Thus you can do a lot more than the
edit/compile/fix cycle!
...
...
*location-list* *E776*
A location list is similar to a quickfix list and contains a list of positions
in files. A location list is associated with a window and each window can have
a separate location list. A location list can be associated with only one window.
The location list is independent of the quickfix list.
...
UPDATE
我發現下面的from here。
These commands all fill a list with the results of their search. "grep" and
"vimgrep" fill the "quickfix list", which can be opened with :cw or :copen,
and is a list shared between ALL windows. "lgrep" and "lvimgrep" fill the
"location list," which is local to the current window, and can be opened
with :lw or :lopen. Both of these lists can be used to instantly jump to
the matching line in whatever file it occurs in.
所以區別在於quickfix列表和本地窗口的位置列表的所有窗口。不過,我可以從任何其他窗口打開位置列表。那麼有什麼區別?
更一般地說:當您的搜索或編譯涉及多個文件時,quickfix列表是最好的,當只涉及單個文件時,最好的位置列表。 –
特別是,如果你用'-q errors.txt'啓動vim,在把'errors.txt'(即'gcc-Wall * .c> errors.txt 2>&1')編譯錯誤後,vim會填充quickfix列表中的編譯錯誤列表,非常方便。 – Kevin
Yahoo!很好的解釋! –