comparison runtime/doc/popup.txt @ 17372:b9bc47742df6

Update runtime files commit https://github.com/vim/vim/commit/396e829fa355ebc92a618ef18266a3fed71b7042 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 13 23:04:31 2019 +0200 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Sat, 13 Jul 2019 23:15:05 +0200
parents d82b0cfb1e82
children b18fd36fdf46
comparison
equal deleted inserted replaced
17371:1062026cb98c 17372:b9bc47742df6
1 *popup.txt* For Vim version 8.1. Last change: 2019 Jul 04 1 *popup.txt* For Vim version 8.1. Last change: 2019 Jul 13
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
176 DETAILS *popup-function-details* 176 DETAILS *popup-function-details*
177 177
178 popup_atcursor({what}, {options}) *popup_atcursor()* 178 popup_atcursor({what}, {options}) *popup_atcursor()*
179 Show the {what} above the cursor, and close it when the cursor 179 Show the {what} above the cursor, and close it when the cursor
180 moves. This works like: > 180 moves. This works like: >
181 call popup_create({what}, { 181 call popup_create({what}, *{
182 \ 'pos': 'botleft', 182 \ pos: 'botleft',
183 \ 'line': 'cursor-1', 183 \ line: 'cursor-1',
184 \ 'col': 'cursor', 184 \ col: 'cursor',
185 \ 'moved': 'WORD', 185 \ moved: 'WORD',
186 \ }) 186 \ })
187 < Use {options} to change the properties. 187 < Use {options} to change the properties.
188 188
189 189
190 popup_beval({what}, {options}) *popup_beval()* 190 popup_beval({what}, {options}) *popup_beval()*
191 Show the {what} above the position from 'ballooneval' and 191 Show the {what} above the position from 'ballooneval' and
192 close it when the mouse moves. This works like: > 192 close it when the mouse moves. This works like: >
193 let pos = screenpos(v:beval_winnr, v:beval_lnum, v:beval_col) 193 let pos = screenpos(v:beval_winnr, v:beval_lnum, v:beval_col)
194 call popup_create({what}, { 194 call popup_create({what}, *{
195 \ 'pos': 'botleft', 195 \ pos: 'botleft',
196 \ 'line': pos.row - 1, 196 \ line: pos.row - 1,
197 \ 'col': pos.col, 197 \ col: pos.col,
198 \ 'mousemoved': 'WORD', 198 \ mousemoved: 'WORD',
199 \ }) 199 \ })
200 < Use {options} to change the properties. 200 < Use {options} to change the properties.
201 See |popup_beval_example| for an example use. 201 See |popup_beval_example| for an example use.
202 202
203 203
238 < In case of failure zero is returned. 238 < In case of failure zero is returned.
239 239
240 240
241 popup_dialog({what}, {options}) *popup_dialog()* 241 popup_dialog({what}, {options}) *popup_dialog()*
242 Just like |popup_create()| but with these default options: > 242 Just like |popup_create()| but with these default options: >
243 call popup_create({what}, { 243 call popup_create({what}, *{
244 \ 'pos': 'center', 244 \ pos: 'center',
245 \ 'zindex': 200, 245 \ zindex: 200,
246 \ 'drag': 1, 246 \ drag: 1,
247 \ 'border': [], 247 \ border: [],
248 \ 'padding': [], 248 \ padding: [],
249 \}) 249 \})
250 < Use {options} to change the properties. E.g. add a 'filter' 250 < Use {options} to change the properties. E.g. add a 'filter'
251 option with value 'popup_filter_yesno'. Example: > 251 option with value 'popup_filter_yesno'. Example: >
252 call popup_create('do you want to quit (Yes/no)?', { 252 call popup_create('do you want to quit (Yes/no)?', *{
253 \ 'filter': 'popup_filter_yesno', 253 \ filter: 'popup_filter_yesno',
254 \ 'callback': 'QuitCallback', 254 \ callback: 'QuitCallback',
255 \ }) 255 \ })
256 256
257 < By default the dialog can be dragged, so that text below it 257 < By default the dialog can be dragged, so that text below it
258 can be read if needed. 258 can be read if needed.
259 259
354 popup_menu({what}, {options}) *popup_menu()* 354 popup_menu({what}, {options}) *popup_menu()*
355 Show the {what} near the cursor, handle selecting one of the 355 Show the {what} near the cursor, handle selecting one of the
356 items with cursorkeys, and close it an item is selected with 356 items with cursorkeys, and close it an item is selected with
357 Space or Enter. {what} should have multiple lines to make this 357 Space or Enter. {what} should have multiple lines to make this
358 useful. This works like: > 358 useful. This works like: >
359 call popup_create({what}, { 359 call popup_create({what}, *{
360 \ 'pos': 'center', 360 \ pos: 'center',
361 \ 'zindex': 200, 361 \ zindex: 200,
362 \ 'drag': 1, 362 \ drag: 1,
363 \ 'wrap': 0, 363 \ wrap: 0,
364 \ 'border': [], 364 \ border: [],
365 \ 'padding': [], 365 \ padding: [],
366 \ 'filter': 'popup_filter_menu', 366 \ filter: 'popup_filter_menu',
367 \ }) 367 \ })
368 < The current line is highlighted with a match using 368 < The current line is highlighted with a match using
369 "PopupSelected", or "PmenuSel" if that is not defined. 369 "PopupSelected", or "PmenuSel" if that is not defined.
370 370
371 Use {options} to change the properties. Should at least set 371 Use {options} to change the properties. Should at least set
389 389
390 390
391 popup_notification({what}, {options}) *popup_notification()* 391 popup_notification({what}, {options}) *popup_notification()*
392 Show the {what} for 3 seconds at the top of the Vim window. 392 Show the {what} for 3 seconds at the top of the Vim window.
393 This works like: > 393 This works like: >
394 call popup_create({what}, { 394 call popup_create({what}, *{
395 \ 'line': 1, 395 \ line: 1,
396 \ 'col': 10, 396 \ col: 10,
397 \ 'minwidth': 20, 397 \ minwidth: 20,
398 \ 'time': 3000, 398 \ time: 3000,
399 \ 'tabpage': -1, 399 \ tabpage: -1,
400 \ 'zindex': 300, 400 \ zindex: 300,
401 \ 'drag': 1, 401 \ drag: 1,
402 \ 'highlight': 'WarningMsg', 402 \ highlight: 'WarningMsg',
403 \ 'border': [], 403 \ border: [],
404 \ 'close': 'click', 404 \ close: 'click',
405 \ 'padding': [0,1,0,1], 405 \ padding: [0,1,0,1],
406 \ }) 406 \ })
407 < The PopupNotification highlight group is used instead of 407 < The PopupNotification highlight group is used instead of
408 WarningMsg if it is defined. 408 WarningMsg if it is defined.
409 409
410 Without the |+timers| feature the poup will not disappear 410 Without the |+timers| feature the poup will not disappear
730 if a:result 730 if a:result
731 " ... 'y' or 'Y' was pressed 731 " ... 'y' or 'Y' was pressed
732 endif 732 endif
733 endfunc 733 endfunc
734 734
735 call popup_dialog('Continue? y/n', { 735 call popup_dialog('Continue? y/n', *{
736 \ 'filter': 'popup_filter_yesno', 736 \ filter: 'popup_filter_yesno',
737 \ 'callback': 'MyDialogHandler', 737 \ callback: 'MyDialogHandler',
738 \ }) 738 \ })
739 < 739 <
740 *popup_menu-shortcut-example* 740 *popup_menu-shortcut-example*
741 Extend popup_filter_menu() with shortcut keys: > 741 Extend popup_filter_menu() with shortcut keys: >
742 742
743 call popup_menu(['Save', 'Cancel', 'Discard'], { 743 call popup_menu(['Save', 'Cancel', 'Discard'], *{
744 \ 'filter': 'MyMenuFilter', 744 \ filter: 'MyMenuFilter',
745 \ 'callback': 'MyMenuHandler', 745 \ callback: 'MyMenuHandler',
746 \ }) 746 \ })
747 747
748 func MyMenuFilter(id, key) 748 func MyMenuFilter(id, key)
749 " Handle shortcuts 749 " Handle shortcuts
750 if a:key == 'S' 750 if a:key == 'S'
779 " Still the same text, keep the existing popup 779 " Still the same text, keep the existing popup
780 return '' 780 return ''
781 endif 781 endif
782 call popup_close(s:winid) 782 call popup_close(s:winid)
783 endif 783 endif
784 let s:winid = popup_beval(v:beval_text, {'mousemoved': 'word'}) 784 let s:winid = popup_beval(v:beval_text, *{mousemoved: 'word'})
785 let s:last_text = v:beval_text 785 let s:last_text = v:beval_text
786 return '' 786 return ''
787 endfunc 787 endfunc
788 < 788 <
789 If the text has to be obtained asynchronously return an empty string from the 789 If the text has to be obtained asynchronously return an empty string from the
810 call timer_start(100, 'ShowPopup') 810 call timer_start(100, 'ShowPopup')
811 return '' 811 return ''
812 endfunc 812 endfunc
813 813
814 func ShowPopup(id) 814 func ShowPopup(id)
815 let s:winid = popup_beval(s:balloonText, {'mousemoved': 'word'}) 815 let s:winid = popup_beval(s:balloonText, *{mousemoved: 'word'})
816 endfunc 816 endfunc
817 < 817 <
818 818
819 vim:tw=78:ts=8:noet:ft=help:norl: 819 vim:tw=78:ts=8:noet:ft=help:norl: