Problem: Cannot specify properties of the info popup window.
Solution: Add the 'completepopup' option. Default to PmenuSel highlight.
-*insert.txt* For Vim version 8.1. Last change: 2019 May 07
+*insert.txt* For Vim version 8.1. Last change: 2019 Aug 18
VIM REFERENCE MANUAL by Bram Moolenaar
menu extra text for the popup menu, displayed after "word"
or "abbr"
info more information about the item, can be displayed in a
- preview window
+ preview or popup window
kind single letter indicating the type of completion
icase when non-zero case is to be ignored when comparing
items to be equal; when omitted zero is used, thus
The "menu" item is used in the popup menu and may be truncated, thus it should
be relatively short. The "info" item can be longer, it will be displayed in
-the preview window when "preview" appears in 'completeopt'. The "info" item
-will also remain displayed after the popup menu has been removed. This is
-useful for function arguments. Use a single space for "info" to remove
-existing text in the preview window. The size of the preview window is three
-lines, but 'previewheight' is used when it has a value of 1 or 2.
+the preview window when "preview" appears in 'completeopt' or in a popup
+window when "popup" appears in 'completeopt'. In the preview window the
+"info" item will also remain displayed after the popup menu has been removed.
+This is useful for function arguments. Use a single space for "info" to
+remove existing text in the preview window. The size of the preview window is
+three lines, but 'previewheight' is used when it has a value of 1 or 2.
+
+ *complete-popup*
+When "popup" is in 'completeopt' a popup window is used to display the "info".
+Then the 'completepopup' option specifies the properties of the popup. The
+option is a comma separated list of values:
+ height maximum height of the popup
+ width maximum width of the popup
+ highlight highlight group of the popup (default is Pmenu)
+Example: >
+ :set completepopup=height:10,width:60,highlight:InfoPopup
The "kind" item uses a single letter to indicate the kind of completion. This
may be used to show the completion differently (different color or icon).
-*options.txt* For Vim version 8.1. Last change: 2019 Aug 17
+*options.txt* For Vim version 8.1. Last change: 2019 Aug 18
VIM REFERENCE MANUAL by Bram Moolenaar
popup Show extra information about the currently selected
completion in a popup window. Only works in combination
with "menu" or "menuone". Overrides "preview".
+ See |'completepopup'| for specifying properties.
{only works when compiled with the +textprop feature}
noinsert Do not insert any text for a match until the user selects
"menu" or "menuone".
+ *'completepopup'* *'cpp'*
+'completepopup' 'cpp' string (default empty)
+ global
+ {not available when compiled without the |+textprop|
+ or |+quickfix| feature}
+ When 'completeopt' contains "popup" then this option is used for the
+ properties of the info popup. See |complete-popup|.
+
+
*'concealcursor'* *'cocu'*
'concealcursor' 'cocu' string (default: "")
local to window
*'fillchars'* *'fcs'*
'fillchars' 'fcs' string (default "vert:|,fold:-")
global
- {not available when compiled without the |+windows|
- and |+folding| features}
+ {not available when compiled without the |+folding|
+ feature}
Characters to fill the statuslines and vertical separators.
It is a comma separated list of items:
*'guitablabel'* *'gtl'*
'guitablabel' 'gtl' string (default empty)
global
- {only available when compiled with GUI enabled and
- with the |+windows| feature}
+ {only available when compiled with GUI enabled}
When nonempty describes the text to use in a label of the GUI tab
pages line. When empty and when the result is empty Vim will use a
default label. See |setting-guitablabel| for more info.
*'guitabtooltip'* *'gtt'*
'guitabtooltip' 'gtt' string (default empty)
global
- {only available when compiled with GUI enabled and
- with the |+windows| feature}
+ {only available when compiled with GUI enabled}
When nonempty describes the text to use in a tooltip for the GUI tab
pages line. When empty Vim will use a default tooltip.
This option is otherwise just like 'guitablabel' above.
*'helpheight'* *'hh'*
'helpheight' 'hh' number (default 20)
global
- {not available when compiled without the |+windows|
- feature}
Minimal initial height of the help window when it is opened with the
":help" command. The initial height of the help window is half of the
current window, or (when the 'ea' option is on) the same as other
*'previewheight'* *'pvh'*
'previewheight' 'pvh' number (default 12)
global
- {not available when compiled without the |+windows| or
- |+quickfix| features}
+ {not available when compiled without the |+quickfix|
+ feature}
Default height for a preview window. Used for |:ptag| and associated
commands. Used for |CTRL-W_}| when no count is given. Not used when
'previewpopup' is set.
*'previewpopup'* *'pvp'*
'previewpopup' 'pvp' string (default empty)
global
- {not available when compiled without the |+windows|,
- |+textprop| or |+quickfix| feature}
+ {not available when compiled without the |+textprop|
+ or |+quickfix| feature}
When not empty a popup window is used for commands that would open a
preview window. See |preview-popup|.
Not used for the insert completion info, add "popup" to
*'pvw'* *'nopvw'* *E590*
'previewwindow' 'pvw' boolean (default off)
local to window
- {not available when compiled without the |+windows| or
- |+quickfix| features}
+ {not available when compiled without the |+quickfix|
+ feature}
Identifies the preview window. Only one window can have this option
set. It's normally not set directly, but by using one of the commands
|:ptag|, |:pedit|, etc.
*'showtabline'* *'stal'*
'showtabline' 'stal' number (default 1)
global
- {not available when compiled without the |+windows|
- feature}
The value of this option specifies when the line with tab page labels
will be displayed:
0: never
*'splitbelow'* *'sb'* *'nosplitbelow'* *'nosb'*
'splitbelow' 'sb' boolean (default off)
global
- {not available when compiled without the |+windows|
- feature}
When on, splitting a window will put the new window below the current
one. |:split|
*'tabline'* *'tal'*
'tabline' 'tal' string (default empty)
global
- {not available when compiled without the |+windows|
- feature}
When nonempty, this option determines the content of the tab pages
line at the top of the Vim window. When empty Vim will use a default
tab pages line. See |setting-tabline| for more info.
*'tabpagemax'* *'tpm'*
'tabpagemax' 'tpm' number (default 10)
global
- {not available when compiled without the |+windows|
- feature}
Maximum number of tab pages to be opened by the |-p| command line
argument or the ":tab all" command. |tabpage|
*'winheight'* *'wh'* *E591*
'winheight' 'wh' number (default 1)
global
- {not available when compiled without the |+windows|
- feature}
Minimal number of lines for the current window. This is not a hard
minimum, Vim will use fewer lines if there is not enough room. If the
focus goes to a window that is smaller, its size is increased, at the
*'winfixheight'* *'wfh'* *'nowinfixheight'* *'nowfh'*
'winfixheight' 'wfh' boolean (default off)
local to window
- {not available when compiled without the |+windows|
- feature}
Keep the window height when windows are opened or closed and
'equalalways' is set. Also for |CTRL-W_=|. Set by default for the
|preview-window| and |quickfix-window|.
*'winfixwidth'* *'wfw'* *'nowinfixwidth'* *'nowfw'*
'winfixwidth' 'wfw' boolean (default off)
local to window
- {not available when compiled without the |+windows|
- feature}
Keep the window width when windows are opened or closed and
'equalalways' is set. Also for |CTRL-W_=|.
The width may be changed anyway when running out of room.
*'winminheight'* *'wmh'*
'winminheight' 'wmh' number (default 1)
global
- {not available when compiled without the |+windows|
- feature}
The minimal height of a window, when it's not the current window.
This is a hard minimum, windows will never become smaller.
When set to zero, windows may be "squashed" to zero lines (i.e. just a
#else
(char_u *)NULL, PV_NONE,
{(char_u *)0L, (char_u *)0L}
+#endif
+ SCTX_INIT},
+ {"completepopup", "cpp", P_STRING|P_VI_DEF|P_COMMA|P_NODUP,
+#ifdef FEAT_TEXT_PROP
+ (char_u *)&p_cpp, PV_NONE,
+ {(char_u *)"", (char_u *)0L}
+#else
+ (char_u *)NULL, PV_NONE,
+ {(char_u *)NULL, (char_u *)0L}
#endif
SCTX_INIT},
{"completeslash", "csl", P_STRING|P_VI_DEF|P_VIM,
if (parse_previewpopup(NULL) == FAIL)
errmsg = e_invarg;
}
+ // 'completepopup'
+ else if (varp == &p_cpp)
+ {
+ if (parse_completepopup(NULL) == FAIL)
+ errmsg = e_invarg;
+ }
#endif
/* Options that are a list of flags. */
#endif
EXTERN int p_gd; // 'gdefault'
#ifdef FEAT_TEXT_PROP
+EXTERN char_u *p_cpp; // 'completepopup'
EXTERN char_u *p_pvp; // 'previewpopup'
#endif
#ifdef FEAT_PRINTER
if (syn_name2id((char_u *)linehl) == 0)
linehl = "PmenuSel";
- sign_define_by_name(sign_name, NULL,
- (char_u *)linehl, NULL, NULL);
+ sign_define_by_name(sign_name, NULL, (char_u *)linehl, NULL, NULL);
}
sign_place(&sign_id, (char_u *)"popupmenu", sign_name,
}
/*
- * Parse the 'previewpopup' option and apply the values to window "wp" if it
- * not NULL.
+ * Parse the 'previewpopup' or 'completepopup' option and apply the values to
+ * window "wp" if it is not NULL.
* Return FAIL if the parsing fails.
*/
- int
-parse_previewpopup(win_T *wp)
+ static int
+parse_popup_option(win_T *wp, int is_preview)
{
char_u *p;
- for (p = p_pvp; *p != NUL; p += (*p == ',' ? 1 : 0))
+ for (p = is_preview ? p_pvp : p_cpp; *p != NUL; p += (*p == ',' ? 1 : 0))
{
char_u *e, *dig;
char_u *s = p;
p = e + STRLEN(e);
dig = e + 1;
x = getdigits(&dig);
- if (dig != p)
- return FAIL;
if (STRNCMP(s, "height:", 7) == 0)
{
+ if (dig != p)
+ return FAIL;
if (wp != NULL)
{
- wp->w_minheight = x;
+ if (is_preview)
+ wp->w_minheight = x;
wp->w_maxheight = x;
}
}
else if (STRNCMP(s, "width:", 6) == 0)
{
+ if (dig != p)
+ return FAIL;
if (wp != NULL)
{
- wp->w_minwidth = x;
+ if (is_preview)
+ wp->w_minwidth = x;
wp->w_maxwidth = x;
}
}
+ else if (STRNCMP(s, "highlight:", 10) == 0)
+ {
+ if (wp != NULL)
+ {
+ int c = *p;
+
+ *p = NUL;
+ set_string_option_direct_in_win(wp, (char_u *)"wincolor", -1,
+ s + 10, OPT_FREE|OPT_LOCAL, 0);
+ *p = c;
+ }
+ }
else
return FAIL;
}
return OK;
}
+/*
+ * Parse the 'previewpopup' option and apply the values to window "wp" if it
+ * is not NULL.
+ * Return FAIL if the parsing fails.
+ */
+ int
+parse_previewpopup(win_T *wp)
+{
+ return parse_popup_option(wp, TRUE);
+}
+
+/*
+ * Parse the 'completepopup' option and apply the values to window "wp" if it
+ * is not NULL.
+ * Return FAIL if the parsing fails.
+ */
+ int
+parse_completepopup(win_T *wp)
+{
+ return parse_popup_option(wp, FALSE);
+}
+
/*
* Set w_wantline and w_wantcol for the cursor position in the current window.
* Keep at least "width" columns from the right of the screen.
wp->w_popup_flags |= POPF_DRAG | POPF_RESIZE;
wp->w_popup_close = POPCLOSE_BUTTON;
add_border_left_right_padding(wp);
+ parse_completepopup(wp);
}
for (i = 0; i < 4; ++i)
int popup_extra_width(win_T *wp);
void popup_adjust_position(win_T *wp);
int parse_previewpopup(win_T *wp);
+int parse_completepopup(win_T *wp);
void popup_set_wantpos_cursor(win_T *wp, int width);
void popup_set_wantpos_rowcol(win_T *wp, int row, int col);
void f_popup_clear(typval_T *argvars, typval_T *rettv);
wcr_attr = syn_name2attr(wp->w_p_wcr);
#ifdef FEAT_TEXT_PROP
else if (WIN_IS_POPUP(wp))
- wcr_attr = HL_ATTR(HLF_PNI);
+ {
+ if (wp->w_popup_flags & POPF_INFO)
+ wcr_attr = HL_ATTR(HLF_PSI); // PmenuSel
+ else
+ wcr_attr = HL_ATTR(HLF_PNI); // Pmenu
+ }
#endif
return wcr_attr;
}
-|t+0&#ffffff0|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|a|w|o|r|d> @15|╔+0#0000001#ffd7ff255|═@15|X| +0#0000000#ffffff0@9
-|~+0#4040ff13&| @23| +0#0000001#e0e0e08|w|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| |║+0&#ffd7ff255| |w|o|r|d|s| |a|r|e| |c|o@1|l| |║| +0#4040ff13#ffffff0@9
-|~| @23| +0#0000001#ffd7ff255|a|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |╚|═@15|⇲| +0#4040ff13#ffffff0@9
+|t+0&#ffffff0|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|a|w|o|r|d> @15|╔+0&#ffff4012|═@15|X| +0&#ffffff0@9
+|~+0#4040ff13&| @23| +0#0000001#e0e0e08|w|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| |║+0#0000000#ffff4012| |w|o|r|d|s| |a|r|e| |c|o@1|l| |║| +0#4040ff13#ffffff0@9
+|~| @23| +0#0000001#ffd7ff255|a|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |╚+0#0000000#ffff4012|═@15|⇲| +0#4040ff13#ffffff0@9
|~| @23| +0#0000001#ffd7ff255|n|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@27
|~| @23| +0#0000001#ffd7ff255|t|h|a|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@27
|~| @73
|t+0&#ffffff0|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|a|n|o|t|h|e|r|w|o|r|d> @37
-|~+0#4040ff13&| @23| +0#0000001#ffd7ff255|w|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| |╔|═@25|X
-|~+0#4040ff13#ffffff0| @23| +0#0000001#e0e0e08|a|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |║+0&#ffd7ff255| |o|t|h|e|r| |w|o|r|d|s| |a|r|e| @9|║
-|~+0#4040ff13#ffffff0| @23| +0#0000001#ffd7ff255|n|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| |║| |c|o@1|l|e|r| |t|h|a|n| |t|h|i|s| |a|n|d| |s|o|m| |║
-|~+0#4040ff13#ffffff0| @23| +0#0000001#ffd7ff255|t|h|a|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |║| |e| |m|o|r|e| |t|e|x|t| @13|║
-|~+0#4040ff13#ffffff0| @45|║+0#0000001#ffd7ff255| |t|o| |m|a|k|e| |w|r|a|p| @12|║
-|~+0#4040ff13#ffffff0| @45|╚+0#0000001#ffd7ff255|═@25|⇲
+|~+0#4040ff13&| @23| +0#0000001#ffd7ff255|w|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| |╔+0#0000000#ffff4012|═@25|X
+|~+0#4040ff13#ffffff0| @23| +0#0000001#e0e0e08|a|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |║+0#0000000#ffff4012| |o|t|h|e|r| |w|o|r|d|s| |a|r|e| @9|║
+|~+0#4040ff13#ffffff0| @23| +0#0000001#ffd7ff255|n|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| |║+0#0000000#ffff4012| |c|o@1|l|e|r| |t|h|a|n| |t|h|i|s| |a|n|d| |s|o|m| |║
+|~+0#4040ff13#ffffff0| @23| +0#0000001#ffd7ff255|t|h|a|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |║+0#0000000#ffff4012| |e| |m|o|r|e| |t|e|x|t| @13|║
+|~+0#4040ff13#ffffff0| @45|║+0#0000000#ffff4012| |t|o| |m|a|k|e| |w|r|a|p| @12|║
+|~+0#4040ff13#ffffff0| @45|╚+0#0000000#ffff4012|═@25|⇲
|~+0#4040ff13#ffffff0| @73
|~| @73
|~| @73
|t+0&#ffffff0|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|e|x|t| |t|n|o|i|n|f|o> @42
|~+0#4040ff13&| @23| +0#0000001#ffd7ff255|w|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| | +0#4040ff13#ffffff0@27
-|~| @23| +0#0000001#ffd7ff255|a|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |╔|═@14|X| +0#4040ff13#ffffff0@10
-|~| @23| +0#0000001#e0e0e08|n|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| |║+0&#ffd7ff255| |n|o| |w|o|r|d|s| |h|e|r|e| |║| +0#4040ff13#ffffff0@10
-|~| @23| +0#0000001#ffd7ff255|t|h|a|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |â\95\9a|â\95\90@14|â\87²| +0#4040ff13#ffffff0@10
-|~| @73
-|~| @73
-|~| @73
+|~| @23| +0#0000001#ffd7ff255|a|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |╔+0#0000000#ffff4012|═@11|X| +0#4040ff13#ffffff0@13
+|~| @23| +0#0000001#e0e0e08|n|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| |║+0#0000000#ffff4012| |l|e|t|s| @5| +0|║+0&#ffff4012| +0#4040ff13#ffffff0@13
+|~| @23| +0#0000001#ffd7ff255|t|h|a|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| |â\95\91+0#0000000#ffff4012| |s|h|o|w| @5| +0|â\95\91+0&#ffff4012| +0#4040ff13#ffffff0@13
+|~| @45|║+0#0000000#ffff4012| |a| @8| +0|║+0&#ffff4012| +0#4040ff13#ffffff0@13
+|~| @45|║+0#0000000#ffff4012| |s|c|r|o|l@1|b|a|r| | +0&#a8a8a8255|║+0&#ffff4012| +0#4040ff13#ffffff0@13
+|~| @45|╚+0#0000000#ffff4012|═@11|⇲| +0#4040ff13#ffffff0@13
|~| @73
|~| @73
|~| @73
let lines =<< trim END
set completeopt+=preview,popup
set completefunc=CompleteFuncDict
+ hi InfoPopup ctermbg=yellow
+ set completepopup=height:4,highlight:InfoPopup
func CompleteFuncDict(findstart, base)
if a:findstart
\ 'word': 'noinfo',
\ 'abbr': 'noawrd',
\ 'menu': 'extra text',
- \ 'info': 'no words here',
+ \ 'info': "lets\nshow\na\nscrollbar\nhere",
\ 'kind': 'W',
\ 'user_data': 'notest'
\ },
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1882,
/**/
1881,
/**/