Saturday, September 25, 2010

Re: Is this a bug with 'previewheight'?

On Sat, 25 Sep 2010, Daniel Vim wrote:

> On 25 September 2010 22:24, Benjamin R. Haskell wrote:
>
>> On Sat, 25 Sep 2010, Daniel Vim wrote:
>>
>>
>>> http://stackoverflow.com/questions/3712725/can-i-change-vim-completion-preview-window-height/3787326#3787326
>>>
>>>
>> Can you provide more context? :help mentions that 'previewheight' is
>> just the default value. If there's an existing preview window, it
>> will be reüsed, and its height won't be altered.
>>
>> [...]
>>
>> Perhaps Eclimd sets up some autocmds that explicitly set the window
>> height?
>>
>
> The preview windows height in the example you gave are also 4 lines.
> (When I disable the work-around of course...).
>
> [...]
>
> I've encountered this issue when I've used the fugitive plugin (a
> plugin for git).
>
> The plugin adds the command :Gstatus that opens a preview window.
>
> The thing is that in my vim that preview window height was only 4
> lines, even after I've explicitly set previewheight=50 in my .vimrc .
> So each time I had to resize it by hand (Ctrl-w 20+)

I installed that plugin and had no problems with it respecting
'previewheight'.

I still think it's either:

1) something else setting previewheight:

Try, after opening a preview window that is unintentionally 4 lines
tall:

:verbose set previewheight?

or

2) something with an autocmd, but I don't really want to dig through
your .vimrc and .vim/ dirs.

If you have a lot of autocmds, you might want to :redir them to a file:

redir! > autocmds
silent! au
redir END
new +/\\cpreview\\\|pv autocmds


> So to workaround this (annoying unproductive) problem - I did what
> I've posted to SO (I am theosp) .

Using a BufEnter autocmd seems sensible.

Why the ?* in this line? just ensuring it's a named buffer?

au BufEnter ?* call PreviewHeightWorkAround()

And a shorter version (a function seems like overkill):

au BufEnter ?* if &pvw | let &l:wh=&pvh | endif

see:
:help :let-&

--
Best,
Ben

--
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

No comments:

Post a Comment