Is there a way to display a tooltip (like a popdown menu, but just with text), where the cursor is, using VimScript?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you mean a tooltip where the mouse cursor is, then you can do this by turning the
balloonevaloption on and setting thebexproption to point to a function that returns your required tooltip. This is only available if you’re using a vim compiled with+balloon_eval(see:version). Have a look at my (rather basic) tag balloons script for an example.If you mean a tooltip where the normal vim cursor is, I don’t think there’s a very clean way to do this. You could create a custom menu with the text that you want (using amenu) and map the command to
:nop<CR>and use:popupto display it:However, this will only work in the Win32 and GTK GUIs.
I don’t know of a way to use the insert mode popup menu (the one used for
Ctrl-Pand omnicompletion etc) to just display some text. You could abuse the completion method to give your own text as the completion alternative and setmenuoneincompleteoptto allow a single line to be shown, but it would probably overwrite the current text with the contents of the popup menu. It would probably also break omnicompletion!