Wednesday, December 3, 2014

Re: The window to be chosen for quickfix

On 2014-12-03, Christian Brabandt wrote:
> Hi Gary!
>
> On Mi, 03 Dez 2014, Gary Johnson wrote:

> > For 3, I think itchyny means the following.
> >
> > The user is editing in the left window of a split display.
> >
> > +-----------+-----------+
> > | active | |
> > | window | |
> > | | |
> > | | |
> > | | |
> > | | |
> > +-----------+-----------+
> >
> > The user then executes :copen. The quickfix window should open at
> > the bottom and be full-width.
> >
> > +-----------+-----------+
> > | | |
> > | | |
> > | | |
> > | | |
> > +-----------+-----------+
> > | quickfix window |
> > +-----------+-----------+
>
>
> I think :botright copen does this (at least it does here). I think,
> there was a patch to fix this behaviour.
>
> > Further, hitting Enter on any line in the quickfix window should
> > open that target in the window that was active at the time the
> > :copen command was executed. In this case, that would be the left
> > window.
>
> That is a personal annoyance of me as well. I do not know a fix for
> this.

I have a fix for that. I had forgotten about it. I got the idea
from yssl's QFEnter.vim plugin,
http://vim.sourceforge.net/scripts/script.php?script_id=4778. I
thought that implementation was overly complicated for what I
needed, so I just extracted and simplified part of it. When jumping
to items from the quickfix window, this opens them in the previous
window instead of the window above the quickfix window.

nnoremap <buffer> <CR> :call QfEnter()<CR>

function! QfEnter()
let l:lnum = line('.')
wincmd p
exe 'cc' l:lnum
endfunction

I put that in ~/.vim/after/ftplugin/qf.vim. The map will therefor
apply only to the quickfix window.

Someone commented in another thread a while back that the quickfix
error number was not always the same as the quickfix window line
number, but that assumption has always worked for me.

Regards,
Gary

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment