Home Explore Blog CI



neovim

41th chunk of `runtime/doc/vimfn.txt`
1320430dcd068aec60fd7bbc0fe23a358b9f5a9eb1c8a5120000000100000fb0
 getcharsearch().forward ? ',' : ';'
<		Also see |setcharsearch()|.

                Return: ~
                  (`table`)

getcharstr([{expr} [, {opts}]])                                   *getcharstr()*
		The same as |getchar()|, except that this always returns a
		String, and "number" isn't allowed in {opts}.

                Parameters: ~
                  • {expr} (`-1|0|1?`)
                  • {opts} (`table?`)

                Return: ~
                  (`string`)

getcmdcomplpat()                                              *getcmdcomplpat()*
		Return completion pattern of the current command-line.
		Only works when the command line is being edited, thus
		requires use of |c_CTRL-\_e| or |c_CTRL-R_=|.
		Also see |getcmdtype()|, |setcmdpos()|, |getcmdline()|,
		|getcmdprompt()|, |getcmdcompltype()| and |setcmdline()|.
		Returns an empty string when completion is not defined.

                Return: ~
                  (`string`)

getcmdcompltype()                                            *getcmdcompltype()*
		Return the type of the current command-line completion.
		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()|,
		|getcmdprompt()|, |getcmdcomplpat()| and |setcmdline()|.
		Returns an empty string when completion is not defined.

                Return: ~
                  (`string`)

getcmdline()                                                      *getcmdline()*
		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: >vim
			cmap <F7> <C-\>eescape(getcmdline(), ' \')<CR>
<		Also see |getcmdtype()|, |getcmdpos()|, |setcmdpos()|,
		|getcmdprompt()| and |setcmdline()|.
		Returns an empty string when entering a password or using
		|inputsecret()|.

                Return: ~
                  (`string`)

getcmdpos()                                                        *getcmdpos()*
		Return the position of the cursor in the command line as a
		byte count.  The first column is 1.
		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()|,
		|getcmdprompt()| and |setcmdline()|.

                Return: ~
                  (`integer`)

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: ~
                  (`string`)

getcmdscreenpos()                                            *getcmdscreenpos()*
		Return the screen position of the cursor in the command line
		as a byte count.  The first column is 1.
		Instead of |getcmdpos()|, it adds the prompt position.
		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 |getcmdpos()|, |setcmdpos()|, |getcmdline()| and
		|setcmdline()|.

                Return: ~
                  (`integer`)

getcmdtype()                                                      *getcmdtype()*
		Return the current command-line type. Possible return values
		are:
		    :	normal Ex command
		    >	debug mode command |debug-mode|
		    /	forward search command
		    ?	backward search command
		    @	|input()| command
		    `-`	|:insert| or |:append| command
		    =	|i_CTRL-R_=|
		Only works when editing the command line, thus requires use of
		|c_CTRL-\_e| or |c_CTRL-R_=| or an expression mapping.
		Returns an empty string otherwise.
		Also see |getcmdpos()|, |setcmdpos()|

Title: Vimscript: getcmdcompltype(), getcmdline(), getcmdpos(), getcmdprompt(), getcmdscreenpos(), and getcmdtype()
Summary
This section describes functions related to the Vim command-line interface. `getcmdcompltype()` retrieves the type of command-line completion. `getcmdcomplpat()` returns the command line's completion pattern. `getcmdline()` retrieves the current command-line input. `getcmdpos()` returns the cursor position (byte count) within the command line. `getcmdprompt()` fetches the current command-line prompt. `getcmdscreenpos()` retrieves the screen position of the cursor in the command line. `getcmdtype()` determines the type of command being entered (e.g., Ex command, search command, input command), these functions primarily work when the command line is actively being edited.