Sample Header Ad - 728x90

Vim. Close the quicklist and return to the original window

1 vote
0 answers
86 views
I'd like to write a function that toggles the quicklist and when closing it, it returns to the window it was in before the quicklist opening. I tried to improve some function I found but it does not work as expected:
function! ToggleQuickFix()
    if empty(filter(getwininfo(), 'v:val.quickfix'))
        copen 20
    else
        call feedkeys("^W^P")
        cclose
    endif
endfunction
Asked by MG5 (11 rep)
Nov 2, 2023, 11:32 AM
Last activity: Nov 2, 2023, 11:33 AM