Friday, September 1, 2017

Re: Quickfix/Location list identifier feature

Yegappan wrote:

> Patch 8.0.1023 added supported for the quickfix list identifier. Now
> each quickfix and location list can be uniquely identified. This is
> needed because the quickfix list number in the quickfix stack is not
> unique and can change as new quickfix lists are added. A Vim plugin that
> asynchronously adds entries to a quickfix list can use the identifier to
> guarantee that the correct list is modified.
>
> Some example uses of this feature are shown below.
>
> To get the current quickfix list identifier:
>
> let myid = getqflist({'id' : 0}).id
>
> To get the identifier of the 4th quickfix list in the stack:
>
> let myid = getqflist({'nr' : 4, 'id' : 0}).id
>
> To get all the items in a quickfix list using the identifier:
>
> let l = getqflist({'id' : myid, 'items' : 1})
>
> To get the title/context/items information using the identifier:
>
> let m = getqflist({'id' : myid, 'all' : 1})
>
> To add entries to a quickfix list using the identifier:
>
> call setqflist([], 'a', {'id' : myid, 'lines':["F1:10:L10"]})
>
> To change the title of a quickfix list using the identifier:
>
> call setqflist([], 'r', {'id' : myid, 'title' : 'newTitle'})
>
> To remove all the entries from a quickfix list:
>
> call setqflist([], 'r', {'id' : myid, 'items' : []})
>
> To check whether a quickfix list with the identifier exists:
>
> if has_key(getqflist({'id' : myid}), 'id')
>
> To get the quickfix list number using the identifier:
>
> echo getqflist({'id' : myid, 'nr' : 0})
>
> To use this with location lists, replace getqflist() with getloclist() and pass
> the window number.

Thanks!

If anybody has remarks about this feature, please mention it now. We
can still change it if needed.

Yegappan - can you add some examples, like the ones above, to ":help
quickfix"?

--
George: "I just got a new set of golf clubs for my wife!"
John: "Great trade!"

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: