I'm not interested in loading an item into a specific window. I'm interested in opening/loading quickfix list into a specific window/pane. Searched online everywhere, but couldn't find it. Does anyone know how to do it?
1 Answer
I don’t know of a built in way to do that, but here’s a function that will do it for you:
function! OpenQuickfixHere() abort
copen
let bufn = bufnr('%')
let winn = winnr()
wincmd p
execute 'b'.bufn
execute winn.'close'
endfunction
To use it, move the cursor to the window into which you would like to place the quickfix, and run the command:
:call OpenQuickfixHere()
You can of course map this or create a custom command for easier access.
It works by opening the quickfix (in a new window, as is standard), making a note of the buffer and window numbers, switching back to the original window, loading the quickfix buffer into that window, and then closing the original quickfix window.