vim中的位置列表和quickfix列表之间的区别是什么
以下是关于quickfix列表和位置列表的文档。但我不知道什么实际上是不同的。下图显示了位置列表和quickfix列表中的相同内容。什么时候在vimgrep和lvimgrep中使用一个。
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. ... 更新 我找到了以下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列表和本地窗口的位置列表。但是,我可以从任何其他窗口打开位置列表。那么有什么区别呢?
位置列表是当前窗口的本地,所以你可以有尽可能多的位置列表作为窗口:30窗口?没问题,这里是你的30个并发位置列表。
quickfix列表是全局的,因此一次不能有多个可用的。有一些命令允许您将当前quickfix列表替换为上一个quickfix列表,但不能有两个并发的quickfix列表。 不要将位置/ quickfix“列表”(数据结构)与位置/ quickfix“窗口”(显示这些数据结构的内容的窗口)混淆。 “窗口”有类似的行为,但“列表”不。差别很重要,因为这些窗口是幸运的不是与这些列表交互的唯一方式:有许多命令允许我们移动这些列表,而不打开关联的窗口,知道这些列表之间的区别是高效使用这些命令的关键。 动手示例: > Do:lvim foo%在foo.txt中为包含foo.txt的窗口创建位置列表。 您跳转到的位置:lne取决于您所在的窗口,但是您跳转到的错误:cn总是相同的(直到您将当前quickfix列表替换为另一个)。 这两个列表都有相对清晰的角色IMO:quickfix列表(和quickfix窗口)通常和相当逻辑地用于错误,并且位置列表(对我来说)适合搜索。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |