4

Is it possible to setup vim to open all preview windows on a specific location. I want them to open on the right side.

1

You could try adding the following to your vimrc:

augroup previewWindowPosition
   au!
   autocmd BufWinEnter * call PreviewWindowPosition()
augroup END
function! PreviewWindowPosition()
   if &previewwindow
      wincmd L
   endif
endfunction    

The :wincmd allows you to use the functionality available in normal mode in the Ctrl+W. And CTRL-W_L moves the current window to the far right.

Unfortunately it is not possible to set the preview window size from the quickfix file type plugin -- probably because the cursor doesn't stay on that window.

This approach will trigger for every window (see BufWinEnter), thus it will add a little overhead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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