On Sun, 25 Jun 2023 12:16:58 -0700
Gary Johnson <[email protected]> wrote:
> 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
> 

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

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230626104657.00004d2d%40gmail.com.

Raspunde prin e-mail lui