callback is removed. This has only
effect if {buf} has 'buftype' set to "prompt".
The callback is invoked when pressing Enter. The current
buffer will always be the prompt buffer. A new line for a
prompt is added before invoking the callback, thus the prompt
for which the callback was invoked will be in the last but one
line.
If the callback wants to add text to the buffer, it must
insert it above the last line, since that is where the current
prompt is. This can also be done asynchronously.
The callback is invoked with one argument, which is the text
that was entered at the prompt. This can be an empty string
if the user only typed Enter.
Example: >vim
func s:TextEntered(text)
if a:text == 'exit' || a:text == 'quit'
stopinsert
" Reset 'modified' to allow the buffer to be closed.
" We assume there is nothing useful to be saved.
set nomodified
close
else
" Do something useful with "a:text". In this example
" we just repeat it.
call append(line('$') - 1, 'Entered: "' .. a:text .. '"')
endif
endfunc
call prompt_setcallback(bufnr(), function('s:TextEntered'))
<
Parameters: ~
• {buf} (`integer|string`)
• {expr} (`string|function`)
Return: ~
(`any`)
prompt_setinterrupt({buf}, {expr}) *prompt_setinterrupt()*
Set a callback for buffer {buf} to {expr}. When {expr} is an
empty string the callback is removed. This has only effect if
{buf} has 'buftype' set to "prompt".
This callback will be invoked when pressing CTRL-C in Insert
mode. Without setting a callback Vim will exit Insert mode,
as in any buffer.
Parameters: ~
• {buf} (`integer|string`)
• {expr} (`string|function`)
Return: ~
(`any`)
prompt_setprompt({buf}, {text}) *prompt_setprompt()*
Set prompt for buffer {buf} to {text}. You most likely want
{text} to end in a space.
The result is only visible if {buf} has 'buftype' set to
"prompt". Example: >vim
call prompt_setprompt(bufnr(''), 'command: ')
<
Parameters: ~
• {buf} (`integer|string`)
• {text} (`string`)
Return: ~
(`any`)
pum_getpos() *pum_getpos()*
If the popup menu (see |ins-completion-menu|) is not visible,
returns an empty |Dictionary|, otherwise, returns a
|Dictionary| with the following keys:
height nr of items visible
width screen cells
row top screen row (0 first row)
col leftmost screen column (0 first col)
size total nr of items
scrollbar |TRUE| if scrollbar is visible
The values are the same as in |v:event| during |CompleteChanged|.
Return: ~
(`any`)
pumvisible() *pumvisible()*
Returns non-zero when the popup menu is visible, zero
otherwise. See |ins-completion-menu|.
This can be used to avoid some things that would remove the
popup menu.
Return: ~
(`any`)
py3eval({expr}) *py3eval()*
Evaluate Python expression {expr} and return its result
converted to Vim data structures.
Numbers and strings are returned as they are (strings are
copied though, Unicode strings are additionally converted to
UTF-8).
Lists are represented as Vim |List| type.
Dictionaries are represented as Vim |Dictionary| type with
keys converted to strings.
Parameters: ~
• {expr} (`any`)
Return: ~
(`any`)
pyeval({expr}) *pyeval()* *E858* *E859*
Evaluate Python expression {expr}