Youcompleteme: Disable Preview Window?

6

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside
the brackets) _before_ filing your issue:

  • [x ] I have read and understood YCM's CONTRIBUTING document.
  • [ x] I have read and understood YCM's CODE_OF_CONDUCT document.
  • [ x] I have read and understood YCM's README, especially the
    Frequently Asked Questions section.
  • [ x] I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. (Example Google
    search.
    )
  • [ ] If filing a bug report, I have included the output of vim --version.
  • [ ] If filing a bug report, I have included the output of :YcmDebugInfo.
  • [ ] If filing a bug report, I have included the output of
    :YcmToggleLogs stderr.
  • [ ] If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • [ ] If filing a bug report, I have included a minimal test case that reproduces
    my issue.
  • [ x] I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt _gift_ of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • [ x] I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Perhaps I'm missing the purpose of the preview window popping up on top ever time I get a completion option, but it seems to just show what already shows up in the completion dropdown. It's kind of annoying and makes me lose focus of the line I'm working on when it shifts down constantly. Is there a way to disable it completely? I've seen options for autoclosing it after completion, but I don't want it at all.

[If filing a bug report, please include a list of steps that describe how to
reproduce the bug you are experiencing. Also include test code if relevant.]

EvilistMonkey picture EvilistMonkey  ·  28 Feb 2016

Most helpful comment

13

if you don't like the preview window popping up then:

puremourning picture puremourning  ·  28 Feb 2016

All comments

13

if you don't like the preview window popping up then:

puremourning picture puremourning  ·  28 Feb 2016
4

Perhaps I'm missing the purpose of the preview window popping up on top ever time I get a completion option, but it seems to just show what already shows up in the completion dropdown.

If the semantic engine for the language you're working can extract the documentation it will display it there. If you get only what you're already getting in the popup menu then it means that either you don't have documentation for the function you're completing or the semantic engine couldn't pick it up.

In any case the preview window on completion is a built in feature of vim and you can turn it off by

set completeopt-=preview

We add the relevant option only if you have let g:ycm_add_preview_to_completeopt = 1 in your configuration.

vheon picture vheon  ·  28 Feb 2016
0

Hah. Issue ninja!

puremourning picture puremourning  ·  28 Feb 2016
0

@Valloric @vheon I am using tern. Is there a way to hide the preview window if there are no doc for the item. Eg. Sometimes my custom function is highlighted in the completion menue, and it opens up the preview window empty. How can i make it not show if its empty.

oscarmorrison picture oscarmorrison  ·  16 Aug 2016
0

I don't think there is a "native" way of doing it (so no option for that), but with some VimL I think is doable:

autocmd WinEnter * if &previewwindow && line2byte( line( '$' ) + 1 ) <=2 | :pclose | endif

I didn't test it, just wrote it :)

vheon picture vheon  ·  16 Aug 2016
7

For anyone else who ends up here, this option is amazing, and might be what you want: https://github.com/Valloric/YouCompleteMe#the-gycm_autoclose_preview_window_after_insertion-option

kybishop picture kybishop  ·  15 Sep 2016
4

The autoclose_preview_window option is handy but it resizes the panes every time it does this. Is there a way to prevent this behaviour?

Henry-E picture Henry-E  ·  2 Feb 2018
0

Is there any way to fix the height?

shuaixr picture shuaixr  ·  6 May 2020
0

These days, if you aren't a fan of the preview window (i'm not), i would recommend using the preview popup

set previewpopup=height:10,width:60,highlight:PMenuSbar
set completeopt+=popup
set completepopup=height:15,width:60,border:off,highlight:PMenuSbar

Otherwise, all the help you need is in :help preview-window

puremourning picture puremourning  ·  6 May 2020