Externalize quickfix function returning text

Useful when one wants to use this function for something else and to
know if a QuickFix window is actually a Location list with qf as
`&filetype`.
This commit is contained in:
Doron Behar 2018-09-28 12:56:49 +03:00
parent a0298263b7
commit 7190164451

View File

@ -13,7 +13,7 @@ endif
function! airline#extensions#quickfix#apply(...) function! airline#extensions#quickfix#apply(...)
if &buftype == 'quickfix' if &buftype == 'quickfix'
let w:airline_section_a = s:get_text() let w:airline_section_a = airline#extensions#quickfix#get_type()
let w:airline_section_b = '%{get(w:, "quickfix_title", "")}' let w:airline_section_b = '%{get(w:, "quickfix_title", "")}'
let w:airline_section_c = '' let w:airline_section_c = ''
let w:airline_section_x = '' let w:airline_section_x = ''
@ -31,7 +31,7 @@ function! airline#extensions#quickfix#inactive_qf_window(...)
endif endif
endfunction endfunction
function! s:get_text() function! airline#extensions#quickfix#get_type()
if exists("*win_getid") && exists("*getwininfo") if exists("*win_getid") && exists("*getwininfo")
let dict = getwininfo(win_getid()) let dict = getwininfo(win_getid())
if len(dict) > 0 && get(dict[0], 'quickfix', 0) && !get(dict[0], 'loclist', 0) if len(dict) > 0 && get(dict[0], 'quickfix', 0) && !get(dict[0], 'loclist', 0)