4

I usually use a layout of one vertical split and two different buffers. When i use :copen, the quickfix window always opens in the right split, regardless where my cursor is. Consequently, if my cursor is in the left split, and I issue the commands :copen, :cclose, the buffer is changed.

Is there any way of opening the quickfix window in the same vertical split where my cursor is?

2
  • 1
    I'm not sure you can easily make it open in the current split but you could use :botright copen to make the window occupy the full width.
    – statox
    Commented Jul 13, 2017 at 7:36
  • 1
    @Isund The quickfix window has the special filetype qf so you could also use an autocommand like autocmd! FileType qf Myfunction() using a function which puts the window where you want.
    – statox
    Commented Jul 13, 2017 at 9:56

1 Answer 1

0

We can use :b{N} to open buffer {N}, and :sb{N} to open the {N}th buffer in a new (horizontal) split. The quickfix window, if it had been opened previously, is an unlisted buffer.

To show all buffers, including unlisted buffers, we can use the :ls! command. An example result would be

  1  a   "a"                            line 0
  2 #a   "b"                            line 0
  3 %a-  "[Quickfix List]"              line 1

showing the quickfix window to be the 3rd buffer. To open the quickfix window in a specific split, simply move over to the desired left or right split, and use :sb3.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.