0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.1.0741: No way to get prompt for input()/confirm()

Problem:  No way to get prompt for input()/confirm()
Solution: add getcmdprompt() function (Shougo Matsushita)
          (Shougo Matsushita)

closes: #15667

Signed-off-by: Shougo Matsushita <Shougo.Matsu@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Shougo Matsushita
2024-09-23 20:34:47 +02:00
committed by Christian Brabandt
parent 770b38df40
commit 6908428560
9 changed files with 86 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
*builtin.txt* For Vim version 9.1. Last change: 2024 Sep 10
*builtin.txt* For Vim version 9.1. Last change: 2024 Sep 23
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -232,8 +232,9 @@ getcharsearch() Dict last character search
getcharstr([{expr}]) String get one character from the user
getcmdcompltype() String return the type of the current
command-line completion
getcmdline() String return the current command-line
getcmdline() String return the current command-line input
getcmdpos() Number return cursor position in command-line
getcmdprompt() String return the current command-line prompt
getcmdscreenpos() Number return cursor screen position in
command-line
getcmdtype() String return current command-line type
@@ -3978,21 +3979,21 @@ getcmdcompltype() *getcmdcompltype()*
Only works when the command line is being edited, thus
requires use of |c_CTRL-\_e| or |c_CTRL-R_=|.
See |:command-completion| for the return string.
Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and
|setcmdline()|.
Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|,
|getcmdprompt()| and |setcmdline()|.
Returns an empty string when completion is not defined.
Return type: |String|
getcmdline() *getcmdline()*
Return the current command-line. Only works when the command
line is being edited, thus requires use of |c_CTRL-\_e| or
|c_CTRL-R_=|.
Return the current command-line input. Only works when the
command line is being edited, thus requires use of
|c_CTRL-\_e| or |c_CTRL-R_=|.
Example: >
:cmap <F7> <C-\>eescape(getcmdline(), ' \')<CR>
< Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()| and
|setcmdline()|.
< Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()|,
|getcmdprompt()| and |setcmdline()|.
Returns an empty string when entering a password or using
|inputsecret()|.
@@ -4005,12 +4006,23 @@ getcmdpos() *getcmdpos()*
Only works when editing the command line, thus requires use of
|c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping.
Returns 0 otherwise.
Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()| and
|setcmdline()|.
Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|,
|getcmdprompt()| and |setcmdline()|.
Return type: |Number|
getcmdprompt() *getcmdprompt()*
Return the current command-line prompt when using functions
like |input()| or |confirm()|.
Only works when the command line is being edited, thus
requires use of |c_CTRL-\_e| or |c_CTRL-R_=|.
Also see |getcmdtype()|, |getcmdline()|, |getcmdpos()|,
|setcmdpos()| and |setcmdline()|.
Return type: |String|
getcmdscreenpos() *getcmdscreenpos()*
Return the screen position of the cursor in the command line
as a byte count. The first column is 1.

View File

@@ -7827,6 +7827,7 @@ getcharstr() builtin.txt /*getcharstr()*
getcmdcompltype() builtin.txt /*getcmdcompltype()*
getcmdline() builtin.txt /*getcmdline()*
getcmdpos() builtin.txt /*getcmdpos()*
getcmdprompt() builtin.txt /*getcmdprompt()*
getcmdscreenpos() builtin.txt /*getcmdscreenpos()*
getcmdtype() builtin.txt /*getcmdtype()*
getcmdwintype() builtin.txt /*getcmdwintype()*

View File

@@ -1,4 +1,4 @@
*usr_41.txt* For Vim version 9.1. Last change: 2024 Jun 09
*usr_41.txt* For Vim version 9.1. Last change: 2024 Sep 23
VIM USER MANUAL - by Bram Moolenaar
@@ -1070,7 +1070,8 @@ Buffers, windows and the argument list:
Command line: *command-line-functions*
getcmdcompltype() get the type of the current command line
completion
getcmdline() get the current command line
getcmdline() get the current command line input
getcmdprompt() get the current command line prompt
getcmdpos() get position of the cursor in the command line
getcmdscreenpos() get screen position of the cursor in the
command line

View File

@@ -41608,6 +41608,7 @@ Functions: ~
|diff()| diff two Lists of strings
|filecopy()| copy a file {from} to {to}
|foreach()| apply function to List items
|getcmdprompt()| get prompt for input()/confirm()
|getregion()| get a region of text from a buffer
|getregionpos()| get a list of positions for a region
|id()| get unique identifier for a Dict, List, Object,