Hi, On Wed, Aug 17, 2016 at 4:12 AM, Michael Henry <[email protected]> wrote: > On 08/17/2016 12:00 AM, Yegappan Lakshmanan wrote: >> I am in particular interested in any comments/suggestions about the > following >> new functions: >> >> getbufinfo() >> gettabinfo() >> getwininfo() >> getqflist() >> setqflist() >> getcompletion() > > I've got some custom functions in my .vimrc related to QuickFix > and Location List windows. They are clunky and inefficient > because as far as I can tell, Vim doesn't expose quite enough > information. I've included the functions below for reference. > > I haven't been able to track all of the new developments, but > perhaps someone can say whether there is a better way than the > below functions (either with pre-existing or recently added Vim > functionality). I'd like functions that: > > - Return True if a given window is a QuickFix or Location List > window. (Both types of window have &buftype == "quickfix".) >
The new getwininfo() function can be used to distinguish between the quickfix and location list windows. Check the 'quickfix' and the 'loclist' keys in the returned dictionary. > > - Return True if the QuickFix is window open. > The getqflist() function returns the window ID of the quickfix window (if it is opened). You can check for this. > > - Return True if the Location List window is open for a given > window. > You can use the getloclist() function for this. > > - Return the window number of the QuickFix window (0 if not > open). > - Return the window number of the associated Location List > for a given window (0 if not open). > You can use the getqflist() and getloclist() functions for these. - Yegappan > > When the current window has ``&buftype == "quickfix"``, I'd > originally tried to determine whether it was a QuickFix window > or a Location List using ``getloclist(0)``. I'd wanted to say > ``isLocationList = (getloclist(0) > 0)``, but that fails when > it's a Location List that happens to be empty, so I resorted to > the uglier hacks you see below. > > I thought I'd seen some activity along these lines that might > expose the details directly, but I haven't been keeping up with > all of the new changes. > > Michael Henry > -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
