What is the best way to distinguish the current buffer is location list or quickfix list?
vim
Solution
Just for new comers: as of now, there is `getwininfo()` which returns dicts containing key `quickfix` which can be used for the check. Also note the `loclist` key.
Since `getwininfo` returns a list of dict, you may use:
getwininfo(win_getid())[0]['quickfix']
which is 1 when it is a quickfix or location list window. And
getwininfo(win_getid())[0]['loclist']
which is 1 only when it is a location list.
In short:
getwininfo() value: 'quickfix' 'loclist'
------------------------------------------------
quickfix list 1 0
location list 1 1
Problem
I have an autocmd, if `ft` is `qf`, it is gonna call some functions to modify the quickfix list by `get/setqflist()` I know there are another pair of functions `get/setloclist()`, to handle the location list. My problem is, how to know if the current buffer is `qf-list` or `location-list` (They both have `filetype` `qf`) so that I know which functions should be called? so far what I can think of is, assume both loc and qf lists are not empty, do some change on qf-list, and compare with current buffer, if the current buffer is changed too, it is qf-list, otherwise it should be location list. Finally roll back the changes. But I feel it is stupid... there should be better way to make the decision. Did I miss some function/flag/variable ?