1- *builtin.txt* For Vim version 9.1. Last change: 2025 Feb 01
1+ *builtin.txt* For Vim version 9.1. Last change: 2025 Feb 06
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -228,12 +228,12 @@ getbufvar({buf}, {varname} [, {def}])
228228getcellpixels() List get character cell pixel size
229229getcellwidths() List get character cell width overrides
230230getchangelist([{buf} ]) List list of change list items
231- getchar([{expr} ]) Number or String
231+ getchar([{expr} [, {opts} ]]) Number or String
232232 get one character from the user
233233getcharmod() Number modifiers for the last typed character
234234getcharpos({expr} ) List position of cursor, mark, etc.
235235getcharsearch() Dict last character search
236- getcharstr([{expr} ]) String get one character from the user
236+ getcharstr([{expr} [, {opts} ]]) String get one character from the user
237237getcmdcomplpat() String return the completion pattern of the
238238 current command-line completion
239239getcmdcompltype() String return the type of the current
@@ -3918,14 +3918,16 @@ getchangelist([{buf}]) *getchangelist()*
39183918 Return type: list<any>
39193919
39203920
3921- getchar([{expr} ]) *getchar()*
3921+ getchar([{expr} [, {opts} ]]) *getchar()*
39223922 Get a single character from the user or input stream.
3923- If {expr} is omitted, wait until a character is available.
3923+ If {expr} is omitted or is -1, wait until a character is
3924+ available.
39243925 If {expr} is 0, only get a character when one is available.
39253926 Return zero otherwise.
39263927 If {expr} is 1, only check if a character is available, it is
39273928 not consumed. Return zero if no character available.
3928- If you prefer always getting a string use | getcharstr() | .
3929+ If you prefer always getting a string use | getcharstr() | , or
3930+ specify | FALSE | as "number" in {opts} .
39293931
39303932 Without {expr} and when {expr} is 0 a whole character or
39313933 special key is returned. If it is a single character, the
@@ -3935,7 +3937,8 @@ getchar([{expr}]) *getchar()*
39353937 starting with 0x80 (decimal: 128). This is the same value as
39363938 the String "\<Key> ", e.g., "\<Left> ". The returned value is
39373939 also a String when a modifier (shift, control, alt) was used
3938- that is not included in the character.
3940+ that is not included in the character. | keytrans() | can also
3941+ be used to convert a returned String into a readable form.
39393942
39403943 When {expr} is 0 and Esc is typed, there will be a short delay
39413944 while Vim waits to see if this is the start of an escape
@@ -3947,6 +3950,31 @@ getchar([{expr}]) *getchar()*
39473950
39483951 Use getcharmod() to obtain any additional modifiers.
39493952
3953+ The optional argument {opts} is a Dict and supports the
3954+ following items:
3955+
3956+ cursor A String specifying cursor behavior
3957+ when waiting for a character.
3958+ "hide": hide the cursor.
3959+ "keep": keep current cursor unchanged.
3960+ "msg": move cursor to message area.
3961+ (default: "msg")
3962+
3963+ number If | TRUE | , return a Number when getting
3964+ a single character.
3965+ If | FALSE | , the return value is always
3966+ converted to a String, and an empty
3967+ String (instead of 0) is returned when
3968+ no character is available.
3969+ (default: | TRUE | )
3970+
3971+ simplify If | TRUE | , include modifiers in the
3972+ character if possible. E.g., return
3973+ the same value for CTRL-I and <Tab> .
3974+ If | FALSE | , don't include modifiers in
3975+ the character.
3976+ (default: | TRUE | )
3977+
39503978 When the user clicks a mouse button, the mouse event will be
39513979 returned. The position can then be found in | v:mouse_col | ,
39523980 | v:mouse_lnum | , | v:mouse_winid | and | v:mouse_win | .
@@ -4062,17 +4090,9 @@ getcharsearch() *getcharsearch()*
40624090 Return type: dict<any>
40634091
40644092
4065- getcharstr([{expr} ]) *getcharstr()*
4066- Get a single character from the user or input stream as a
4067- string.
4068- If {expr} is omitted, wait until a character is available.
4069- If {expr} is 0 or false, only get a character when one is
4070- available. Return an empty string otherwise.
4071- If {expr} is 1 or true, only check if a character is
4072- available, it is not consumed. Return an empty string
4073- if no character is available.
4074- Otherwise this works like | getchar() | , except that a number
4075- result is converted to a string.
4093+ getcharstr([{expr} [, {opts} ]]) *getcharstr()*
4094+ The same as | getchar() | , except that this always returns a
4095+ String, and "number" isn't allowed in {opts} .
40764096
40774097 Return type: | String |
40784098
@@ -12730,6 +12750,7 @@ gui_win32s idem, and Win32s system being used (Windows 3.1)
1273012750haiku Haiku version of Vim.
1273112751hangul_input Compiled with Hangul input support. | hangul |
1273212752hpux HP-UX version of Vim.
12753+ hurd GNU/Hurd version of Vim
1273312754iconv Can use iconv() for conversion.
1273412755insert_expand Compiled with support for CTRL-X expansion commands in
1273512756 Insert mode. (always true)
0 commit comments