On Thursday, December 4, 2014 4:34:17 AM UTC+9, Gary Johnson wrote:
> 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.
>
> Regards,
> Gary

Thank you so much all and Gary's solution seems to be the best answer. Thank
you, Gary. Now I define some more mappings inside quickfix buffer so that I can
open the code as I like.

augroup vimrc-quickfix
  autocmd!
  autocmd FileType qf call s:quickfix_setting()
augroup END
function! s:quickfix_setting()
  wincmd J
  nnoremap <buffer><silent> <CR>  :<C-u>call <SID>qfenter('wincmd p')<CR>
  nnoremap <buffer><silent> <C-t> :<C-u>call <SID>qfenter('tabnew')<CR>
  nnoremap <buffer><silent> <C-v> :<C-u>call <SID>qfenter('wincmd p <bar> 
vnew')<CR>
endfunction
function! s:qfenter(cmd)
  let lnum = line('.')
  silent! execute a:cmd
  silent! execute 'cc' lnum
endfunction

Now I'm very happy with the behaviour. The quickfix window is opened with the 
full
width. And the code is opened at the place I hit :copen. I can open the code at
new tab or in a vertically splitted new window. Maybe my code will be better by
fixing the cc command to switching cc/ll as Ben suggested. Thank you for sharing
your configuration, Ben

Regards,
itchyny

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to