[vim/vim] :copen opens quickfix window below `lastwin` instead of `curwin` (Issue #12501)

40 views
Skip to first unread message

Munif Tanjim

unread,
Jun 7, 2023, 1:35:07 PM6/7/23
to vim/vim, Subscribed

Steps to reproduce

  1. Create a new split on the right
  2. Jump to the left window
  3. :copen
  4. Quickfix window is opened below the right split

Expected behaviour

:copen should open the window below current window as it says here: https://github.com/vim/vim/blob/cdb7b4c50826df254d2e5ba8abd211e49b7a9784/src/quickfix.c#L4274

Version of Vim

VIM - Vi IMproved 8.1

Environment

N/A

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12501@github.com>

Munif Tanjim

unread,
Jun 7, 2023, 1:44:56 PM6/7/23
to vim/vim, Subscribed

Might be that I'm misunderstanding the expected behavior.

If it's not supposed to be opened under curwin, would it be possible to change the default behavior to open with WSP_BOT (instead of WSP_BELOW)?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12501/1581254782@github.com>

Bram Moolenaar

unread,
Jun 24, 2023, 4:21:41 PM6/24/23
to vim/vim, Subscribed

The help states:

Normally the quickfix window is at the bottom of the screen.  If there are
vertical splits, it's at the bottom of the rightmost column of windows.

Is that not what is happening? A comment in the code can easily be changed, I
rather not change the actual behavior unless there is a good reason.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12501/1605715707@github.com>

Tony Mechelynck

unread,
Jun 24, 2023, 8:37:12 PM6/24/23
to vim/vim, Subscribed

Yeah, that's what the OP is describing.

IOW: "T'ain't a bug, it's a feature."


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12501/1605794240@github.com>

Munif Tanjim

unread,
Jun 25, 2023, 1:02:59 AM6/25/23
to vim/vim, Subscribed

Is that not what is happening?

Ah yes. The behavior is following the help text.

Makes sense.

I rather not change the actual behavior unless there is a good reason.

Opening qf window at the bottom right corner, by default, makes it seem like the quickfix list is somehow related to the window at bottom right corner. So opening it at the bottom of the editor seems more intuitive to me.

But it's your call... if this change is not desired, the issue can be closed.

Thanks.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12501/1605872500@github.com>

Christian Brabandt

unread,
Jun 25, 2023, 6:34:15 AM6/25/23
to vim/vim, Subscribed

You may want to use the locationlist window instead, I think it should be opened below the currently active window instead.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12501/1606016577@github.com>

Munif Tanjim

unread,
Jun 25, 2023, 6:44:33 AM6/25/23
to vim/vim, Subscribed

Yeah, but locationlist is bound to a specific window.

If we want list that contains locations from various files across the codebase, quickfix list is the appropriate feature, right?

And since it's not bound to any specific window, (to me) it feels like bottom-of-the-editor would be better suited place to open it by default. Many plugins I use explicity executes :botright copen because of that. Would've been nice if :copen did that by default.

But again, it's the maintainers' call. If you think this shouldn't be changed, the issue can be closed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12501/1606019155@github.com>

Christian Brabandt

unread,
Jun 25, 2023, 1:55:44 PM6/25/23
to vim/vim, Subscribed

Closed #12501 as completed.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/12501/issue_event/9630473516@github.com>

Christian Brabandt

unread,
Jun 25, 2023, 1:55:46 PM6/25/23
to vim/vim, Subscribed

If we want list that contains locations from various files across the codebase, quickfix list is the appropriate feature, right?

What has that to do with the other? I tend to use the locationlist, because it is more flexible and you can have more than one. But it doesn't depend on whether I want to visit files across the codebase.

But as has been said, I think changing the existing behaviour may surprise a lot of users, let's leave it as it. Also it should be possible to move the window around to a certain extend afterwards. So let's close it then.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12501/1606196992@github.com>

Gary Johnson

unread,
Jun 25, 2023, 3:18:04 PM6/25/23
to reply+ACY5DGCD63KJHYOTC4...@reply.github.com, vim...@googlegroups.com
On 2023-06-07, Munif Tanjim wrote:
> Might be that I'm misunderstanding the expected behavior.
>
> If it's not supposed to be opened under curwin, would it be possible to change
> the default behavior to open with WSP_BOT (instead of WSP_BELOW)?

I didn't like the default behavior, either, so I added this to my
~/.vim/after/ftplugin/qf.vim.

" The following is taken from the QFEnter.vim plugin,
" http://vim.sourceforge.net/scripts/script.php?script_id=4778,
" by yssl. I extracted and simplified the part I needed: When
" jumping to items from the quickfix window, open them in the
" previous window instead of the window above the quickfix
" window.

nnoremap <buffer> <silent> <CR> :call QfEnter()<CR>
let b:undo_ftplugin .= "| nunmap <buffer> <CR>"

function! QfEnter()
let l:lnum = line('.')
wincmd p
try
exe 'cc' l:lnum
normal! zv
catch /E37/
if &errorbells
normal \<Esc> " Generate a bell
endif
echohl ErrorMsg
echo matchstr(v:exception, ':\zs.*')
echohl None
endtry
endfunction

HTH,
Gary

Enan Ajmain

unread,
Jun 26, 2023, 12:47:09 AM6/26/23
to Gary Johnson, vim...@googlegroups.com, reply+ACY5DGCD63KJHYOTC4...@reply.github.com
Thank you for this. It sometime annoys me when pressing Enter on QF
window opens the file in a different window than the one I previously
accessed.

But out of curiosity, this isn't what OP was after, is it? Munif was
looking to change the default QF behavior by opening the QF window under
the current window. Your function, Gary, opens the file in QF entry in
the previous window. They are different asks, AFAI can tell.

--
Enan

vim-dev ML

unread,
Jun 26, 2023, 12:47:27 AM6/26/23
to vim/vim, vim-dev ML, Your activity


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/12501/1606590267@github.com>

Munif Tanjim

unread,
Jun 26, 2023, 12:54:44 AM6/26/23
to vim/vim, vim-dev ML, Comment

Munif was looking to change the default QF behavior by opening the QF window under
the current window.

Just a small correction... not under the current window, but under the whole editor.

So, if there are existing windows A, B and C, I wanted :copen to do this by default:

---------
|   | B |
| A |---|
|   | C | 
---------
|  QF   |
---------


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/12501/1606619309@github.com>

Munif Tanjim

unread,
Jun 26, 2023, 12:56:58 AM6/26/23
to vim/vim, vim-dev ML, Comment

Munif was looking to change the default QF behavior by opening the QF window under
the current window.

Yeah, I wanted it to open under current window initially (when creating the issue).

But later thought that under the whole editor makes more sense... so, if there are existing windows A, B and C, it makes more sense for :copen to do this by default:

---------
|   | B |
| A |---|
|   | C | 
---------
|  QF   |
---------


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/issues/12501/1606626484@github.com>

Gary Johnson

unread,
Jun 26, 2023, 1:15:37 AM6/26/23
to vim...@googlegroups.com
On 2023-06-26, Enan Ajmain wrote:

> But out of curiosity, this isn't what OP was after, is it? Munif was
> looking to change the default QF behavior by opening the QF window under
> the current window. Your function, Gary, opens the file in QF entry in
> the previous window. They are different asks, AFAI can tell.

I believe you are correct. I read the OP's request too hastily.
Thank you for the tactful correction.

Regards,
Gary

Reply all
Reply to author
Forward
0 new messages