1

When using <c-x><c-o>, vim opens a signature preview window which is different from the one opened when using :ptag.

How to open that one when not completing like when reviewing in normal mode?

I don't want the full file for preview like with :ptag. Just the signature and some type metadata from tags.

I set omnifunc=syntaxcomplete#Complete. Not using any completion plugins.

6
  • Which filetype? This is usually a documentation popup. It usually only appears when preview is in completeopt.
    – D. Ben Knoble
    Feb 27, 2020 at 16:43
  • filetype C. Yes completeopt has preview by default.
    – bkdm
    Feb 27, 2020 at 16:59
  • Are you sure that’s what omnifunc is set to? I ask only because the default filetype uses a special c completion function. At any rate, the best bet is probably Man for stdlib functions. I think some of the code is hardwired in there, especially when completing tags.
    – D. Ben Knoble
    Feb 27, 2020 at 17:00
  • yes you are right. It is ccomplete#Complete. I am still not able to find the code that opens that preview window.
    – bkdm
    Feb 27, 2020 at 17:05
  • The function ccomplete#Complete doesn't seem to read completeopt or open preview window by itself. May be some autocommand is doing this.
    – bkdm
    Feb 27, 2020 at 17:10

2 Answers 2

0

Maybe you can use :set cot=. To know more info see cot

0

The way that "signature window", really "preview window", works is this:

  • The :help 'omnifunc', if there is one, returns a list of dictionaries, one for each completion suggestion.
  • Those dictionaries can have a non-mandatory info field that contains the text to display in the preview window if preview is in :help 'completeopts'.
  • The preview window is triggered automatically when completeopts contains preview AND when the info field is populated.

In this case, that info field is populated on the fly by ccomplete#Complete(), with info gathered from tags, files, etc.. It is the value of that field that is displayed in the preview window and there is currently no built-in way to get that exact text in a preview window or elsewhere without using omni-completion.

Now, all the code used to generate that info field is under $VIMRUNTIME/autoload/ccomplete.vim (and it even has been rewritten in vim9script) so it should be doable to cobble something up out of it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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