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.
...
更新
我从这里找到了以下内容。
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 list 适用于所有窗口,local window 只适用于当前窗口的 location list。但是,我可以从任何其他窗口打开 location list。那么,它们有什么区别呢?
-q errors.txt
参数运行vim,在将编译错误放入errors.txt
后(例如:gcc -Wall *.c >errors.txt 2>&1
),vim会从编译错误列表中填充快速修复列表,这非常方便。 - Kevinfoo1.txt
,foo2.txt
,...)以查找foo
,并在右窗口中搜索多个文件(bar1.txt
,bar2.txt
,...)以查找bar
。您可以在左窗口中运行:lv foo foo*
,然后在右窗口中运行:lv bar bar*
。然后,在左窗口中,:lne
将显示下一个匹配项foo
,而不是bar
。这是因为:lv
使用您运行它的窗口的位置列表,因此每个搜索都有自己的位置列表。 - ma11hew28