1

When I type some letters and hit CTRL+P, vim shows a list of possible words that may complete my letters. On the left of the list, it shows the completed word. And on the right of the list, it shows where vim finds the word (like a name of a file that contains the word).

However, if there's only one possible word, vim doesn't show the list but just shows -- Keyword completion (^N^P) The only match on the status bar. How to make vim show where it finds the word as well?

3
  • What plugin(s) are you using for completion?
    – B Layer
    Commented Jun 20, 2021 at 3:48
  • @BLayer I'm not using any plugin. I installed gvim on Windows and the function is already there when I hit CTRL+P. I believe it's a built-in function.
    – Haoshu
    Commented Jun 20, 2021 at 4:24
  • Okay, cool, just wanted to verify.
    – B Layer
    Commented Jun 20, 2021 at 4:42

1 Answer 1

1

I found the answer to my own question: add menuone to completeopt by: set completeopt+=menuone. As help completeopt shows:

   menuone  Use the popup menu also when there is only one match.
            Useful when there is additional information about the
            match, e.g., what file it comes from.

FWIW, I found it by searching for The only match in the source code , and tracing how the match list is generated. Then I found this function with the comment.

Your Answer

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

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