Is this a bug with 'previewheight'?

52 views
Skip to first unread message

Daniel Vim

unread,
Sep 25, 2010, 12:00:15 PM9/25/10
to vim...@googlegroups.com

Benjamin R. Haskell

unread,
Sep 25, 2010, 4:24:51 PM9/25/10
to vim...@googlegroups.com
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.

Using the example from :help :pedit:

" opens a preview window of height 12 (default)
:ped +/fputc /usr/include/stdio.h

" move to preview window, delete its buffer
<C-w>k :bd

" change the default
:set previewheight=50

" opens a preview window of height 50
:ped +/fputc /usr/include/stdio.h


Perhaps Eclimd sets up some autocmds that explicitly set the window
height?

--
Best,
Ben

Daniel Vim

unread,
Sep 25, 2010, 5:44:30 PM9/25/10
to vim...@googlegroups.com

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

The preview windows height in the example you gave are also 4 lines. (When I disable the work-around of course...).


I am using vim 7.3 (downloaded from here compiled with --with-x) my ~/.vimrc and ~/.vim dir.

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

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

Thanks

Benjamin R. Haskell

unread,
Sep 26, 2010, 1:12:17 AM9/26/10
to vim...@googlegroups.com
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

Reply all
Reply to author
Forward
0 new messages