1- *eval.txt* For Vim version 8.2. Last change: 2020 Aug 15
1+ *eval.txt* For Vim version 8.2. Last change: 2020 aug 30
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1135,7 +1135,7 @@ In legacy Vim script:
11351135If expr8 is a Number or String this results in a String that contains the
11361136expr1'th single byte from expr8. expr8 is used as a String (a number is
11371137automatically converted to a String), expr1 as a Number. This doesn't
1138- recognize multi-byte encodings, see `byteidx()` for an alternative, or use
1138+ recognize multibyte encodings, see `byteidx()` for an alternative, or use
11391139`split()` to turn the string into a list of characters. Example, to get the
11401140byte under the cursor: >
11411141 :let c = getline(".")[col(".") - 1]
@@ -1163,12 +1163,12 @@ error.
11631163
11641164expr8[expr1a : expr1b] substring or sublist *expr-[:]*
11651165
1166- If expr8 is a String this results in the substring with the bytes from expr1a
1167- to and including expr1b. expr8 is used as a String, expr1a and expr1b are
1168- used as a Number.
1166+ If expr8 is a String this results in the substring with the bytes or
1167+ characters from expr1a to and including expr1b. expr8 is used as a String,
1168+ expr1a and expr1b are used as a Number.
11691169
11701170In legacy Vim script the indexes are byte indexes. This doesn't recognize
1171- multi-byte encodings, see |byteidx()| for computing the indexes. If expr8 is
1171+ multibyte encodings, see |byteidx()| for computing the indexes. If expr8 is
11721172a Number it is first converted to a String.
11731173
11741174In Vim9 script the indexes are character indexes. To use byte indexes use
@@ -1185,6 +1185,7 @@ expr1b is smaller than expr1a the result is an empty string.
11851185
11861186Examples: >
11871187 :let c = name[-1:] " last byte of a string
1188+ :let c = name[0:-1] " the whole string
11881189 :let c = name[-2:-2] " last but one byte of a string
11891190 :let s = line(".")[4:] " from the fifth byte to the end
11901191 :let s = s[:-3] " remove last two bytes
@@ -2371,7 +2372,7 @@ assert_equalfile({fname-one}, {fname-two} [, {msg}])
23712372 Number assert file contents are equal
23722373assert_exception({error} [, {msg}])
23732374 Number assert {error} is in v:exception
2374- assert_fails({cmd} [, {error} [, {msg}]])
2375+ assert_fails({cmd} [, {error} [, {msg} [, {lnum}] ]])
23752376 Number assert {cmd} fails
23762377assert_false({actual} [, {msg}])
23772378 Number assert {actual} is false
@@ -2437,6 +2438,7 @@ ch_status({handle} [, {options}])
24372438 String status of channel {handle}
24382439changenr() Number current change number
24392440char2nr({expr} [, {utf8}]) Number ASCII/UTF8 value of first char in {expr}
2441+ charclass({string}) Number character class of {string}
24402442chdir({dir}) String change current working directory
24412443cindent({lnum}) Number C indent for line {lnum}
24422444clearmatches([{win}]) none clear all matches
@@ -2557,6 +2559,7 @@ gettabvar({nr}, {varname} [, {def}])
25572559gettabwinvar({tabnr}, {winnr}, {name} [, {def}])
25582560 any {name} in {winnr} in tab page {tabnr}
25592561gettagstack([{nr}]) Dict get the tag stack of window {nr}
2562+ gettext({text}) String lookup translation of {text}
25602563getwininfo([{winid}]) List list of info about each window
25612564getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window
25622565getwinposx() Number X coord in pixels of the Vim window
@@ -2780,6 +2783,7 @@ setbufline({expr}, {lnum}, {text})
27802783 {expr}
27812784setbufvar({expr}, {varname}, {val})
27822785 none set {varname} in buffer {expr} to {val}
2786+ setcellwidths({list}) none set character cell width overrides
27832787setcharsearch({dict}) Dict set character search from {dict}
27842788setcmdpos({pos}) Number set cursor position in command-line
27852789setenv({name}, {val}) none set environment variable
@@ -3531,6 +3535,18 @@ char2nr({expr} [, {utf8}]) *char2nr()*
35313535 Can also be used as a |method|: >
35323536 GetChar()->char2nr()
35333537
3538+
3539+ charclass({string}) *charclass()*
3540+ Return the character class of the first character in {string}.
3541+ The character class is one of:
3542+ 0 blank
3543+ 1 punctuation
3544+ 2 word character
3545+ 3 emoji
3546+ other specific Unicode class
3547+ The class is used in patterns and word motions.
3548+
3549+
35343550chdir({dir}) *chdir()*
35353551 Change the current working directory to {dir}. The scope of
35363552 the directory change depends on the directory of the current
@@ -5719,6 +5735,7 @@ getreginfo([{regname}]) *getreginfo()*
57195735 If {regname} is invalid or not set, an empty Dictionary
57205736 will be returned.
57215737 If {regname} is not specified, |v:register| is used.
5738+ The returned Dictionary can be passed to |setreg()|.
57225739
57235740 Can also be used as a |method|: >
57245741 GetRegname()->getreginfo()
@@ -5825,6 +5842,19 @@ gettagstack([{nr}]) *gettagstack()*
58255842 Can also be used as a |method|: >
58265843 GetWinnr()->gettagstack()
58275844
5845+
5846+ gettext({text}) *gettext()*
5847+ Translate {text} if possible.
5848+ This is mainly for use in the distributed Vim scripts. When
5849+ generating message translations the {text} is extracted by
5850+ xgettext, the translator can add the translated message in the
5851+ .po file and Vim will lookup the translation when gettext() is
5852+ called.
5853+ For {text} double quoted strings are preferred, because
5854+ xgettext does not understand escaping in single quoted
5855+ strings.
5856+
5857+
58285858getwininfo([{winid}]) *getwininfo()*
58295859 Returns information about windows as a |List| with Dictionaries.
58305860
@@ -6013,7 +6043,7 @@ has({feature} [, {check}])
60136043 zero otherwise. This is useful to check for a typo in
60146044 {feature} and to detect dead code. Keep in mind that an older
60156045 Vim version will not know about a feature added later and
6016- features that have been abandoned will not be know by the
6046+ features that have been abandoned will not be known by the
60176047 current Vim version.
60186048
60196049 Also see |exists()|.
@@ -8949,6 +8979,31 @@ setbufvar({expr}, {varname}, {val}) *setbufvar()*
89498979 third argument: >
89508980 GetValue()->setbufvar(buf, varname)
89518981
8982+
8983+ setcellwidths({list}) *setcellwidths()*
8984+ Specify overrides for cell widths of character ranges. This
8985+ tells Vim how wide characters are, counted in screen cells.
8986+ This overrides 'ambiwidth'. Example: >
8987+ setcellwidths([[0xad, 0xad, 1],
8988+ \ [0x2194, 0x2199, 2]])
8989+
8990+ < *E1109* *E1110* *E1111* *E1112* *E1113*
8991+ The {list} argument is a list of lists with each three
8992+ numbers. These three numbers are [low, high, width]. "low"
8993+ and "high" can be the same, in which case this refers to one
8994+ character. Otherwise it is the range of characters from "low"
8995+ to "high" (inclusive). "width" is either 1 or 2, indicating
8996+ the character width in screen cells.
8997+ An error is given if the argument is invalid, also when a
8998+ range overlaps with another.
8999+ Only characters with value 0x100 and higher can be used.
9000+
9001+ To clear the overrides pass an empty list: >
9002+ setcellwidths([]);
9003+ < You can use the script $VIMRUNTIME/tools/emoji_list.vim to see
9004+ the effect for known emoji characters.
9005+
9006+
89529007setcharsearch({dict}) *setcharsearch()*
89539008 Set the current character search information to {dict},
89549009 which contains one or more of the following entries:
@@ -11406,7 +11461,7 @@ mouse_urxvt Compiled with support for urxvt mouse.
1140611461mouse_xterm Compiled with support for xterm mouse.
1140711462mouseshape Compiled with support for 'mouseshape'.
1140811463multi_byte Compiled with support for 'encoding' (always true)
11409- multi_byte_encoding 'encoding' is set to a multi-byte encoding.
11464+ multi_byte_encoding 'encoding' is set to a multibyte encoding.
1141011465multi_byte_ime Compiled with support for IME input method.
1141111466multi_lang Compiled with support for multiple languages.
1141211467mzscheme Compiled with MzScheme interface |mzscheme|.
0 commit comments