2019-05-26 21:33:31 +02:00
|
|
|
*popup.txt* For Vim version 8.1. Last change: 2019 May 26
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
|
|
|
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
Displaying text in floating window. *popup* *popup-window*
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
|
|
|
|
|
|
|
|
1. Introduction |popup-intro|
|
|
|
|
2. Functions |popup-functions|
|
|
|
|
3. Examples |popup-examples|
|
|
|
|
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
{not available if the |+eval| feature was disabled at compile time}
|
|
|
|
{not able to use text properties if the |+textprop| feature was disabled at
|
|
|
|
compile time}
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
1. Introduction *popup-intro*
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
We are talking about popup windows here, text that goes on top of the regular
|
|
|
|
windows and is under control of a plugin. You cannot edit the text in the
|
|
|
|
popup window like with regular windows.
|
|
|
|
|
|
|
|
A popup window can be used for such things as:
|
2019-05-26 21:33:31 +02:00
|
|
|
- briefly show a message without overwriting the command line
|
2019-05-21 23:09:01 +02:00
|
|
|
- prompt the user with a dialog
|
2019-05-25 19:51:39 +02:00
|
|
|
- display contextual information while typing
|
2019-05-21 23:09:01 +02:00
|
|
|
- give extra information for auto-completion
|
|
|
|
|
|
|
|
The text in the popup window can be colored with |text-properties|. It is
|
|
|
|
also possible to use syntax highlighting.
|
|
|
|
|
2019-05-25 19:51:39 +02:00
|
|
|
The default color used is "Pmenu". If you prefer something else use the
|
|
|
|
"highlight" argument or the 'wincolor' option, e.g.: >
|
|
|
|
hi MyPopupColor ctermbg=lightblue guibg=lightblue
|
|
|
|
call setwinvar(winid, '&wincolor', 'MyPopupColor')
|
|
|
|
|
|
|
|
'hlsearch' and match highlighting are not displayed in a popup window.
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
A popup window has a window-ID like other windows, but behaves differently.
|
|
|
|
The size can be up to the whole Vim window and it overlaps other windows.
|
2019-05-26 21:33:31 +02:00
|
|
|
Popup windows can also overlap each other.
|
|
|
|
|
|
|
|
The popup window contains a buffer, and that buffer is always associated with
|
|
|
|
the popup window. The window cannot be used in Normal, Visual or Insert mode,
|
|
|
|
it does not get keyboard focus. You can use functions like `setbufline()` to
|
|
|
|
change the text in the buffer. There are more differences from how this
|
|
|
|
window and buffer behave compared to regular windows and buffers, see
|
|
|
|
|popup-buffer|.
|
2019-05-21 23:09:01 +02:00
|
|
|
|
|
|
|
If this is not what you are looking for, check out other popup functionality:
|
2019-05-12 21:43:48 +02:00
|
|
|
- popup menu, see |popup-menu|
|
|
|
|
- balloon, see |balloon-eval|
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
|
2019-05-25 19:51:39 +02:00
|
|
|
WINDOW POSITION AND SIZE *popup-position*
|
|
|
|
|
2019-05-26 21:33:31 +02:00
|
|
|
The height of the window is normally equal to the number of, possibly
|
|
|
|
wrapping, lines in the buffer. It can be limited with the "maxheight"
|
|
|
|
property. You can use empty lines to increase the height.
|
2019-05-25 19:51:39 +02:00
|
|
|
|
|
|
|
The width of the window is normally equal to the longest line in the buffer.
|
|
|
|
It can be limited with the "maxwidth" property. You can use spaces to
|
|
|
|
increase the width.
|
|
|
|
|
|
|
|
By default the 'wrap' option is set, so that no text disappears. However, if
|
|
|
|
there is not enough space, some text may be invisible.
|
|
|
|
|
|
|
|
|
2019-05-29 21:44:40 +02:00
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
TODO:
|
|
|
|
|
|
|
|
Example how to use syntax highlighting of a code snippet.
|
|
|
|
|
|
|
|
Scrolling: When the screen scrolls up for output of an Ex command, what
|
|
|
|
happens with popups?
|
|
|
|
1. Stay where they are. Problem: listed text may go behind and can't be read.
|
|
|
|
2. Scroll with the page. What if they get updated? Either postpone, or take
|
|
|
|
the scroll offset into account.
|
|
|
|
Probably 2. is the best choice.
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENTATION:
|
2019-05-25 19:51:39 +02:00
|
|
|
- Code is in popupwin.c
|
2019-05-29 20:26:46 +02:00
|
|
|
- when creating the window set options to Vim default? (verify with 'number')
|
|
|
|
- Do not show tilde below last line.
|
2019-05-26 21:33:31 +02:00
|
|
|
- Implement filter.
|
2019-05-29 20:26:46 +02:00
|
|
|
Check that popup_close() works in the filter.
|
2019-05-26 21:33:31 +02:00
|
|
|
- Handle screen resize in screenalloc().
|
2019-05-25 19:51:39 +02:00
|
|
|
- Make redrawing more efficient and avoid flicker.
|
2019-05-29 20:26:46 +02:00
|
|
|
Fix redrawing problem with completion.
|
|
|
|
Fix redrawing problem when scrolling non-current window
|
|
|
|
Fix redrawing the statusline on top of a popup
|
2019-05-26 21:33:31 +02:00
|
|
|
- Properly figure out the size and position.
|
2019-05-29 20:26:46 +02:00
|
|
|
- Can the buffer be re-used, to avoid using up lots of buffer numbers?
|
2019-05-26 21:33:31 +02:00
|
|
|
- Implement all the unimplemented options and features.
|
2019-05-21 23:09:01 +02:00
|
|
|
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
2. Functions *popup-functions*
|
|
|
|
|
|
|
|
THIS IS UNDER DESIGN - ANYTHING MAY STILL CHANGE
|
|
|
|
|
2019-05-26 21:33:31 +02:00
|
|
|
[functions to be moved to eval.txt later, keep overview of functions here]
|
2019-05-12 21:43:48 +02:00
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
popup_create({text}, {options}) *popup_create()*
|
|
|
|
Open a popup window showing {text}, which is either:
|
|
|
|
- a string
|
|
|
|
- a list of strings
|
|
|
|
- a list of text lines with text properties
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
{options} is a dictionary with many possible entries.
|
2019-05-21 23:09:01 +02:00
|
|
|
See |popup_create-usage| for details.
|
2019-05-12 21:43:48 +02:00
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
Returns a window-ID, which can be used with other popup
|
|
|
|
functions. Use `winbufnr()` to get the number of the buffer
|
|
|
|
in the window: >
|
|
|
|
let winid = popup_create('hello', {})
|
|
|
|
let bufnr = winbufnr(winid)
|
|
|
|
call setbufline(bufnr, 2, 'second line')
|
2019-05-25 19:51:39 +02:00
|
|
|
< In case of failure zero is returned.
|
|
|
|
|
|
|
|
|
|
|
|
popup_close({id}) *popup_close()*
|
|
|
|
Close popup {id}. The window and the associated buffer will
|
|
|
|
be deleted.
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
popup_dialog({text}, {options}) *popup_dialog()*
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-21 23:09:01 +02:00
|
|
|
Just like |popup_create()| but with these default options: >
|
|
|
|
call popup_create({text}, {
|
|
|
|
\ 'pos': 'center',
|
|
|
|
\ 'zindex': 200,
|
|
|
|
\ 'border': [],
|
|
|
|
\})
|
|
|
|
< Use {options} to change the properties.
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
popup_notification({text}, {options}) *popup_notification()*
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-21 23:09:01 +02:00
|
|
|
Show the {text} for 3 seconds at the top of the Vim window.
|
|
|
|
This works like: >
|
|
|
|
call popup_create({text}, {
|
2019-05-12 21:43:48 +02:00
|
|
|
\ 'line': 1,
|
|
|
|
\ 'col': 10,
|
|
|
|
\ 'time': 3000,
|
2019-05-21 23:09:01 +02:00
|
|
|
\ 'tab': -1,
|
2019-05-12 21:43:48 +02:00
|
|
|
\ 'zindex': 200,
|
|
|
|
\ 'highlight': 'WarningMsg',
|
2019-05-26 20:10:06 +02:00
|
|
|
\ 'border': [],
|
2019-05-12 21:43:48 +02:00
|
|
|
\ })
|
|
|
|
< Use {options} to change the properties.
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
|
2019-05-12 21:43:48 +02:00
|
|
|
popup_atcursor({text}, {options}) *popup_atcursor()*
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-21 23:09:01 +02:00
|
|
|
Show the {text} above the cursor, and close it when the cursor
|
|
|
|
moves. This works like: >
|
|
|
|
call popup_create({text}, {
|
2019-05-12 21:43:48 +02:00
|
|
|
\ 'line': 'cursor-1',
|
|
|
|
\ 'col': 'cursor',
|
|
|
|
\ 'moved': 'WORD',
|
|
|
|
\ })
|
|
|
|
< Use {options} to change the properties.
|
|
|
|
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
popup_menu({text}, {options}) *popup_menu()*
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-21 23:09:01 +02:00
|
|
|
Show the {text} near the cursor, handle selecting one of the
|
2019-05-12 21:43:48 +02:00
|
|
|
items with cursorkeys, and close it an item is selected with
|
2019-05-21 23:09:01 +02:00
|
|
|
Space or Enter. {text} should have multiple lines to make this
|
|
|
|
useful. This works like: >
|
|
|
|
call popup_create({text}, {
|
2019-05-12 21:43:48 +02:00
|
|
|
\ 'pos': 'center',
|
|
|
|
\ 'zindex': 200,
|
|
|
|
\ 'wrap': 0,
|
|
|
|
\ 'border': [],
|
|
|
|
\ 'filter': 'popup_filter_menu',
|
|
|
|
\ })
|
|
|
|
< Use {options} to change the properties. Should at least set
|
|
|
|
"callback" to a function that handles the selected item.
|
|
|
|
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
popup_hide({id}) *popup_hide()*
|
|
|
|
If {id} is a displayed popup, hide it now. If the popup has a
|
|
|
|
filter it will not be invoked for so long as the popup is
|
|
|
|
hidden.
|
2019-05-26 22:17:52 +02:00
|
|
|
If window {id} does not exist nothing happens. If window {id}
|
|
|
|
exists but is not a popup window an error is given. *E993*
|
|
|
|
|
|
|
|
popup_show({id}) *popup_show()*
|
|
|
|
If {id} is a hidden popup, show it now.
|
|
|
|
For {id} see `popup_hide()`.
|
2019-05-21 23:09:01 +02:00
|
|
|
|
2019-05-12 21:43:48 +02:00
|
|
|
popup_move({id}, {options}) *popup_move()*
|
|
|
|
Move popup {id} to the position speficied with {options}.
|
2019-05-21 23:09:01 +02:00
|
|
|
{options} may contain the items from |popup_create()| that
|
2019-05-12 21:43:48 +02:00
|
|
|
specify the popup position: "line", "col", "pos", "maxheight",
|
|
|
|
"minheight", "maxwidth" and "minwidth".
|
2019-05-26 22:17:52 +02:00
|
|
|
For {id} see `popup_hide()`.
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
popup_filter_menu({id}, {key}) *popup_filter_menu()*
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
Filter that can be used for a popup. It handles the cursor
|
|
|
|
keys to move the selected index in the popup. Space and Enter
|
|
|
|
can be used to select an item. Invokes the "callback" of the
|
|
|
|
popup menu with the index of the selected line as the second
|
|
|
|
argument.
|
|
|
|
|
|
|
|
|
|
|
|
popup_filter_yesno({id}, {key}) *popup_filter_yesno()*
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
Filter that can be used for a popup. It handles only the keys
|
|
|
|
'y', 'Y' and 'n' or 'N'. Invokes the "callback" of the
|
|
|
|
popup menu with the 1 for 'y' or 'Y' and zero for 'n' or 'N'
|
|
|
|
as the second argument. Pressing Esc and CTRL-C works like
|
|
|
|
pressing 'n'.
|
|
|
|
|
|
|
|
|
|
|
|
popup_setoptions({id}, {options}) *popup_setoptions()*
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
Override options in popup {id} with entries in {options}.
|
|
|
|
|
|
|
|
|
|
|
|
popup_getoptions({id}) *popup_getoptions()*
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
Return the {options} for popup {id}.
|
|
|
|
|
2019-05-25 19:51:39 +02:00
|
|
|
popup_getposition({id}) *popup_getposition()*
|
|
|
|
Return the position and size of popup {id}. Returns a Dict
|
|
|
|
with these entries:
|
|
|
|
col screen column of the popup, one-based
|
|
|
|
line screen line of the popup, one-based
|
|
|
|
width width of the popup in screen cells
|
|
|
|
height height of the popup in screen cells
|
2019-05-29 20:26:46 +02:00
|
|
|
Note that these are the actual screen positions. They differ
|
|
|
|
from the values in `popup_getoptions()` for the sizing and
|
|
|
|
positioning mechanism applied.
|
|
|
|
If popup window {id} is not found an empty Dict is returned.
|
2019-05-25 19:51:39 +02:00
|
|
|
|
2019-05-12 21:43:48 +02:00
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
*:popupclear* *:popupc*
|
|
|
|
:popupc[lear] Emergency solution to a misbehaving plugin: close all popup
|
|
|
|
windows.
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
POPUP BUFFER AND WINDOW *popup-buffer*
|
|
|
|
|
|
|
|
A new buffer is created to hold the text and text properties of the popup
|
|
|
|
window. The buffer is always associated with the popup window and
|
|
|
|
manipulation is restricted:
|
|
|
|
- the buffer has no name
|
|
|
|
- 'buftype' is "popup"
|
|
|
|
- 'swapfile' is off
|
|
|
|
- 'bufhidden' is "hide"
|
|
|
|
- 'buflisted' is off
|
2019-05-25 19:51:39 +02:00
|
|
|
- 'undolevels' is -1: no undo at all
|
2019-05-21 23:09:01 +02:00
|
|
|
TODO: more
|
|
|
|
|
2019-05-26 21:33:31 +02:00
|
|
|
It is possible to change these options, but anything might break then, so
|
|
|
|
better leave them alone.
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
The window does have a cursor position, but the cursor is not displayed.
|
|
|
|
|
2019-05-29 21:44:40 +02:00
|
|
|
To execute a command in the context of the popup window and buffer use
|
|
|
|
`win_execute()`. Example: >
|
|
|
|
call win_execute(winid, 'syntax enable')
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
Options can be set on the window with `setwinvar()`, e.g.: >
|
|
|
|
call setwinvar(winid, '&wrap', 0)
|
|
|
|
And options can be set on the buffer with `setbufvar()`, e.g.: >
|
|
|
|
call setbufvar(winbufnr(winid), '&filetype', 'java')
|
|
|
|
|
|
|
|
|
|
|
|
POPUP_CREATE() ARGUMENTS *popup_create-usage*
|
|
|
|
|
|
|
|
The first argument of |popup_create()| specifies the text to be displayed, and
|
|
|
|
optionally text properties. It is in one of three forms:
|
|
|
|
- a string
|
|
|
|
- a list of strings
|
|
|
|
- a list of dictionaries, where each dictionary has these entries:
|
|
|
|
text String with the text to display.
|
2019-05-12 21:43:48 +02:00
|
|
|
props A list of text properties. Optional.
|
|
|
|
Each entry is a dictionary, like the third argument of
|
|
|
|
|prop_add()|, but specifying the column in the
|
|
|
|
dictionary with a "col" entry, see below:
|
|
|
|
|popup-props|.
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
The second argument of |popup_create()| is a dictionary with options:
|
2019-05-12 21:43:48 +02:00
|
|
|
line screen line where to position the popup; can use
|
|
|
|
"cursor", "cursor+1" or "cursor-1" to use the line of
|
|
|
|
the cursor and add or subtract a number of lines;
|
|
|
|
default is "cursor-1".
|
2019-05-25 19:51:39 +02:00
|
|
|
{only number is implemented}
|
2019-05-12 21:43:48 +02:00
|
|
|
col screen column where to position the popup; can use
|
|
|
|
"cursor" to use the column of the cursor, "cursor+99"
|
|
|
|
and "cursor-99" to add or subtract a number of
|
|
|
|
columns; default is "cursor"
|
2019-05-25 19:51:39 +02:00
|
|
|
{only number is implemented}
|
2019-05-12 21:43:48 +02:00
|
|
|
pos "topleft", "topright", "botleft" or "botright":
|
|
|
|
defines what corner of the popup "line" and "col" are
|
|
|
|
used for. Default is "botleft". Alternatively
|
2019-05-25 19:51:39 +02:00
|
|
|
"center" can be used to position the popup in the
|
|
|
|
center of the Vim window.
|
|
|
|
{not implemented yet}
|
2019-05-21 23:09:01 +02:00
|
|
|
flip when TRUE (the default) and the position is relative
|
|
|
|
to the cursor, flip to below or above the cursor to
|
|
|
|
avoid overlap with the |popupmenu-completion| or
|
|
|
|
another popup with a higher "zindex"
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
maxheight maximum height
|
|
|
|
minheight minimum height
|
|
|
|
maxwidth maximum width
|
|
|
|
minwidth minimum width
|
2019-05-21 23:09:01 +02:00
|
|
|
hidden when TRUE the popup exists but is not displayed; use
|
|
|
|
`popup_show()` to unhide it.
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-21 23:09:01 +02:00
|
|
|
tab when -1: display the popup on all tabs; when 0 (the
|
|
|
|
default): display the popup on the current tab;
|
|
|
|
otherwise the number of the tab page the popup is
|
|
|
|
displayed on; when invalid the current tab is used
|
2019-05-25 19:51:39 +02:00
|
|
|
{only -1 and 0 are implemented}
|
2019-05-12 21:43:48 +02:00
|
|
|
title text to be displayed above the first item in the
|
|
|
|
popup, on top of any border
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
wrap TRUE to make the lines wrap (default TRUE)
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
|
|
|
highlight highlight group name to use for the text, stored in
|
2019-05-26 21:03:24 +02:00
|
|
|
the 'wincolor' option
|
2019-05-12 21:43:48 +02:00
|
|
|
border list with numbers, defining the border thickness
|
|
|
|
above/right/below/left of the popup; an empty list
|
|
|
|
uses a border of 1 all around
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
borderhighlight highlight group name to use for the border
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
borderchars list with characters, defining the character to use
|
|
|
|
for the top/right/bottom/left border; optionally
|
|
|
|
followed by the character to use for the
|
|
|
|
topright/botright/botleft/topleft corner; an empty
|
|
|
|
list can be used to show a double line all around
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
zindex priority for the popup, default 50
|
|
|
|
time time in milliseconds after which the popup will close;
|
|
|
|
when omitted |popup_close()| must be used.
|
|
|
|
moved "cell": close the popup if the cursor moved at least
|
|
|
|
one screen cell; "word" allows for moving within
|
|
|
|
|<cword>|, "WORD" allows for moving within |<cWORD>|,
|
|
|
|
a list with two numbers specifies the start and end
|
|
|
|
column
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
filter a callback that can filter typed characters, see
|
|
|
|
|popup-filter|
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
callback a callback to be used when the popup closes, e.g. when
|
|
|
|
using |popup_filter_menu()|, see |popup-callback|.
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
Depending on the "zindex" the popup goes under or above other popups. The
|
|
|
|
completion menu (|popup-menu|) has zindex 100. For messages that occur for a
|
|
|
|
short time the suggestion is to use zindex 1000.
|
|
|
|
|
|
|
|
By default text wraps, which causes a line in {lines} to occupy more than one
|
|
|
|
screen line. When "wrap" is FALSE then the text outside of the popup or
|
|
|
|
outside of the Vim window will not be displayed, thus truncated.
|
|
|
|
|
|
|
|
|
|
|
|
POPUP TEXT PROPERTIES *popup-props*
|
|
|
|
|
2019-05-26 23:32:06 +02:00
|
|
|
These are similar to the third argument of |prop_add()| except:
|
|
|
|
- "lnum" is always the current line in the list
|
|
|
|
- "bufnr" is always the buffer of the popup
|
|
|
|
- "col" is in the Dict instead of a separate argument
|
|
|
|
- "transparent" is extra
|
|
|
|
So we get:
|
2019-05-12 21:43:48 +02:00
|
|
|
col starting column, counted in bytes, use one for the
|
|
|
|
first column.
|
|
|
|
length length of text in bytes; can be zero
|
2019-05-26 23:32:06 +02:00
|
|
|
end_lnum line number for the end of the text
|
2019-05-12 21:43:48 +02:00
|
|
|
end_col column just after the text; not used when "length" is
|
|
|
|
present; when {col} and "end_col" are equal, this is a
|
|
|
|
zero-width text property
|
|
|
|
id user defined ID for the property; when omitted zero is
|
|
|
|
used
|
|
|
|
type name of the text property type, as added with
|
|
|
|
|prop_type_add()|
|
|
|
|
transparent do not show these characters, show the text under it;
|
|
|
|
if there is an border character to the right or below
|
|
|
|
it will be made transparent as well
|
2019-05-26 23:32:06 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
POPUP FILTER *popup-filter*
|
|
|
|
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-21 23:09:01 +02:00
|
|
|
A callback that gets any typed keys while a popup is displayed. The filter is
|
2019-05-25 19:51:39 +02:00
|
|
|
not invoked when the popup is hidden.
|
2019-05-21 23:09:01 +02:00
|
|
|
|
|
|
|
The filter can return TRUE to indicate the key has been handled and is to be
|
|
|
|
discarded, or FALSE to let Vim handle the key as usual in the current state.
|
2019-05-25 19:51:39 +02:00
|
|
|
In case it returns FALSE and there is another popup window visible, that
|
|
|
|
filter is also called. The filter of the popup window with the highest zindex
|
|
|
|
is called first.
|
2019-05-12 21:43:48 +02:00
|
|
|
|
|
|
|
The filter function is called with two arguments: the ID of the popup and the
|
|
|
|
key.
|
|
|
|
|
|
|
|
Some common key actions:
|
|
|
|
Esc close the popup
|
|
|
|
cursor keys select another entry
|
|
|
|
Tab accept current suggestion
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
A mouse click arrives as <LeftMouse>. The coordinates are in
|
|
|
|
v:mouse_popup_col and v:mouse_popup_row. The top-left screen cell of the
|
|
|
|
popup is col 1, row 1 (not counting the border).
|
|
|
|
|
2019-05-12 21:43:48 +02:00
|
|
|
Vim provides standard filters |popup_filter_menu()| and
|
|
|
|
|popup_filter_yesno()|.
|
|
|
|
|
|
|
|
|
|
|
|
POPUP CALLBACK *popup-callback*
|
|
|
|
|
2019-05-25 19:51:39 +02:00
|
|
|
{not implemented yet}
|
2019-05-12 21:43:48 +02:00
|
|
|
A callback that is invoked when the popup closes. Used by
|
|
|
|
|popup_filter_menu()|. Invoked with two arguments: the ID of the popup and
|
|
|
|
the result, which would usually be an index in the popup lines, or whatever
|
|
|
|
the filter wants to pass.
|
|
|
|
|
|
|
|
==============================================================================
|
|
|
|
3. Examples *popup-examples*
|
|
|
|
|
|
|
|
TODO
|
|
|
|
|
|
|
|
Prompt the user to press y/Y or n/N: >
|
|
|
|
|
|
|
|
func MyDialogHandler(id, result)
|
|
|
|
if a:result
|
|
|
|
" ... 'y' or 'Y' was pressed
|
|
|
|
endif
|
|
|
|
endfunc
|
|
|
|
|
2019-05-21 23:09:01 +02:00
|
|
|
call popup_create(['Continue? y/n'], {
|
2019-05-12 21:43:48 +02:00
|
|
|
\ 'filter': 'popup_filter_yesno',
|
|
|
|
\ 'callback': 'MyDialogHandler',
|
|
|
|
\ })
|
|
|
|
<
|
|
|
|
|
|
|
|
vim:tw=78:ts=8:noet:ft=help:norl:
|