1- *popup.txt* For Vim version 8.1. Last change: 2019 Jun 02
1+ *popup.txt* For Vim version 8.1. Last change: 2019 Jun 09
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -89,15 +89,18 @@ Probably 2. is the best choice.
8989
9090
9191IMPLEMENTATION:
92- - Code is in popupwin.c
92+ - buffers remain after popup was deleted.
93+ - do not redraw whole window when popup was changed, mark affected lines for
94+ redraw.
9395- Why does 'nrformats' leak from the popup window buffer???
94- - Make redrawing more efficient and avoid flicker.
95- First draw popups, creating a mask, use the mask in screen_line() when
96- drawing other windows and stuff. Mask contains zindex of popups.
97- Keep mask until next update_screen(), use when drawing status lines.
98- Remove update_popup() calls after draw_tabline()/updating statusline
99- Fix redrawing problem with completion.
100- Fix redrawing problem when scrolling non-current window
96+ - Add 'balloonpopup' : instead of showing text, let the callback open a balloon
97+ and return the window ID. The popup will then be closed when the mouse
98+ moves, except when it moves inside the popup.
99+ - For the "moved" property also include mouse movement?
100+ - Make redrawing more efficient and avoid flicker:
101+ - put popup menu also put in popup_mask?
102+ - Use changes in popup_mask to decide what windows and range of lines to
103+ redraw?
101104- Disable commands, feedkeys(), CTRL-W , etc. in a popup window.
102105 Use NOT_IN_POPUP_WINDOW for more commands.
103106- Invoke filter with character before mapping?
@@ -115,6 +118,33 @@ THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
115118
116119[functions to be moved to eval.txt later, keep overview of functions here]
117120
121+ popup_atcursor({text} , {options} ) *popup_atcursor()*
122+ Show the {text} above the cursor, and close it when the cursor
123+ moves. This works like: >
124+ call popup_create({text}, {
125+ \ 'pos': 'botleft',
126+ \ 'line': 'cursor-1',
127+ \ 'col': 'cursor',
128+ \ 'moved': 'WORD',
129+ \ })
130+ < Use {options} to change the properties.
131+
132+
133+ *popup_clear()*
134+ popup_clear() Emergency solution to a misbehaving plugin: close all popup
135+ windows.
136+
137+
138+ popup_close({id} [, {result} ]) *popup_close()*
139+ Close popup {id} . The window and the associated buffer will
140+ be deleted.
141+
142+ If the popup has a callback it will be called just before the
143+ popup window is deleted. If the optional {result} is present
144+ it will be passed as the second argument of the callback.
145+ Otherwise zero is passed to the callback.
146+
147+
118148popup_create({text} , {options} ) *popup_create()*
119149 Open a popup window showing {text} , which is either:
120150 - a string
@@ -133,16 +163,6 @@ popup_create({text}, {options}) *popup_create()*
133163< In case of failure zero is returned.
134164
135165
136- popup_close({id} [, {result} ]) *popup_close()*
137- Close popup {id} . The window and the associated buffer will
138- be deleted.
139-
140- If the popup has a callback it will be called just before the
141- popup window is deleted. If the optional {result} is present
142- it will be passed as the second argument of the callback.
143- Otherwise zero is passed to the callback.
144-
145-
146166popup_dialog({text} , {options} ) *popup_dialog()*
147167 {not implemented yet}
148168 Just like | popup_create() | but with these default options: >
@@ -155,70 +175,6 @@ popup_dialog({text}, {options}) *popup_dialog()*
155175< Use {options} to change the properties.
156176
157177
158- popup_notification({text} , {options} ) *popup_notification()*
159- {not implemented yet}
160- Show the {text} for 3 seconds at the top of the Vim window.
161- This works like: >
162- call popup_create({text}, {
163- \ 'line': 1,
164- \ 'col': 10,
165- \ 'time': 3000,
166- \ 'tab': -1,
167- \ 'zindex': 200,
168- \ 'highlight': 'WarningMsg',
169- \ 'border': [],
170- \ })
171- < Use {options} to change the properties.
172-
173-
174- popup_atcursor({text} , {options} ) *popup_atcursor()*
175- Show the {text} above the cursor, and close it when the cursor
176- moves. This works like: >
177- call popup_create({text}, {
178- \ 'pos': 'botleft',
179- \ 'line': 'cursor-1',
180- \ 'col': 'cursor',
181- \ 'moved': 'WORD',
182- \ })
183- < Use {options} to change the properties.
184-
185-
186- popup_menu({text} , {options} ) *popup_menu()*
187- {not implemented yet}
188- Show the {text} near the cursor, handle selecting one of the
189- items with cursorkeys, and close it an item is selected with
190- Space or Enter. {text} should have multiple lines to make this
191- useful. This works like: >
192- call popup_create({text}, {
193- \ 'pos': 'center',
194- \ 'zindex': 200,
195- \ 'wrap': 0,
196- \ 'border': [],
197- \ 'filter': 'popup_filter_menu',
198- \ })
199- < Use {options} to change the properties. Should at least set
200- "callback" to a function that handles the selected item.
201-
202-
203- popup_hide({id} ) *popup_hide()*
204- If {id} is a displayed popup, hide it now. If the popup has a
205- filter it will not be invoked for so long as the popup is
206- hidden.
207- If window {id} does not exist nothing happens. If window {id}
208- exists but is not a popup window an error is given. *E993*
209-
210- popup_show({id} ) *popup_show()*
211- If {id} is a hidden popup, show it now.
212- For {id} see `popup_hide ()` .
213-
214- popup_move({id} , {options} ) *popup_move()*
215- Move popup {id} to the position speficied with {options} .
216- {options} may contain the items from | popup_create() | that
217- specify the popup position: "line", "col", "pos", "maxheight",
218- "minheight", "maxwidth" and "minwidth".
219- For {id} see `popup_hide ()` .
220-
221-
222178popup_filter_menu({id} , {key} ) *popup_filter_menu()*
223179 {not implemented yet}
224180 Filter that can be used for a popup. It handles the cursor
@@ -237,11 +193,6 @@ popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
237193 pressing 'n'.
238194
239195
240- popup_setoptions({id} , {options} ) *popup_setoptions()*
241- {not implemented yet}
242- Override options in popup {id} with entries in {options} .
243-
244-
245196popup_getoptions({id} ) *popup_getoptions()*
246197 Return the {options} for popup {id} in a Dict.
247198 A zero value means the option was not set. For "zindex" the
@@ -253,6 +204,7 @@ popup_getoptions({id}) *popup_getoptions()*
253204
254205< If popup window {id} is not found an empty Dict is returned.
255206
207+
256208popup_getpos({id} ) *popup_getpos()*
257209 Return the position and size of popup {id} . Returns a Dict
258210 with these entries:
@@ -274,9 +226,64 @@ popup_getpos({id}) *popup_getpos()*
274226 If popup window {id} is not found an empty Dict is returned.
275227
276228
277- *:popupclear* *:popupc*
278- :popupc[lear] Emergency solution to a misbehaving plugin: close all popup
279- windows.
229+ popup_hide({id} ) *popup_hide()*
230+ If {id} is a displayed popup, hide it now. If the popup has a
231+ filter it will not be invoked for so long as the popup is
232+ hidden.
233+ If window {id} does not exist nothing happens. If window {id}
234+ exists but is not a popup window an error is given. *E993*
235+
236+
237+ popup_menu({text} , {options} ) *popup_menu()*
238+ {not implemented yet}
239+ Show the {text} near the cursor, handle selecting one of the
240+ items with cursorkeys, and close it an item is selected with
241+ Space or Enter. {text} should have multiple lines to make this
242+ useful. This works like: >
243+ call popup_create({text}, {
244+ \ 'pos': 'center',
245+ \ 'zindex': 200,
246+ \ 'wrap': 0,
247+ \ 'border': [],
248+ \ 'filter': 'popup_filter_menu',
249+ \ })
250+ < Use {options} to change the properties. Should at least set
251+ "callback" to a function that handles the selected item.
252+
253+
254+ popup_move({id} , {options} ) *popup_move()*
255+ Move popup {id} to the position speficied with {options} .
256+ {options} may contain the items from | popup_create() | that
257+ specify the popup position: "line", "col", "pos", "maxheight",
258+ "minheight", "maxwidth" and "minwidth".
259+ For {id} see `popup_hide ()` .
260+
261+
262+ popup_notification({text} , {options} ) *popup_notification()*
263+ {not implemented yet}
264+ Show the {text} for 3 seconds at the top of the Vim window.
265+ This works like: >
266+ call popup_create({text}, {
267+ \ 'line': 1,
268+ \ 'col': 10,
269+ \ 'time': 3000,
270+ \ 'tab': -1,
271+ \ 'zindex': 200,
272+ \ 'highlight': 'WarningMsg',
273+ \ 'border': [],
274+ \ })
275+ < Use {options} to change the properties.
276+
277+
278+ popup_show({id} ) *popup_show()*
279+ If {id} is a hidden popup, show it now.
280+ For {id} see `popup_hide ()` .
281+
282+
283+ popup_setoptions({id} , {options} ) *popup_setoptions()*
284+ {not implemented yet}
285+ Override options in popup {id} with entries in {options} .
286+
280287
281288
282289POPUP BUFFER AND WINDOW *popup-buffer*
@@ -405,7 +412,8 @@ The second argument of |popup_create()| is a dictionary with options:
405412 By default a double line is used all around when
406413 'encoding' is "utf-8", otherwise ASCII characters are
407414 used.
408- zindex Priority for the popup, default 50.
415+ zindex Priority for the popup, default 50. Mininum value is
416+ 1, maximum value is 32000.
409417 time Time in milliseconds after which the popup will close.
410418 When omitted | popup_close() | must be used.
411419 moved Specifies to close the popup if the cursor moved:
@@ -496,7 +504,7 @@ Vim provides standard filters |popup_filter_menu()| and
496504
497505Note that "x" is the normal way to close a popup. You may want to use Esc,
498506but since many keys start with an Esc character, there may be a delay before
499- Vim recognizes the Esc key. If you do use Esc, it is reecommended to set the
507+ Vim recognizes the Esc key. If you do use Esc, it is recommended to set the
500508'ttimeoutlen' option to 100 and set 'timeout' and/or 'ttimeout' .
501509
502510
0 commit comments