1- *builtin.txt* For Vim version 9.1. Last change: 2025 Jan 02
1+ *builtin.txt* For Vim version 9.1. Last change: 2025 Jan 17
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -72,6 +72,7 @@ base64_encode({blob}) String base64 encode the bytes in {blob}
7272bindtextdomain({package} , {path} )
7373 Bool bind text domain to specified path
7474blob2list({blob} ) List convert {blob} into a list of numbers
75+ blob2str({blob} [, {options} ]) List convert {blob} into a list of strings
7576browse({save} , {title} , {initdir} , {default} )
7677 String put up a file requester
7778browsedir({title} , {initdir} ) String put up a directory requester
@@ -609,6 +610,8 @@ split({expr} [, {pat} [, {keepempty}]])
609610sqrt({expr} ) Float square root of {expr}
610611srand([{expr} ]) List get seed for | rand() |
611612state([{what} ]) String current state of Vim
613+ str2blob({list} [, {options} ])
614+ Blob convert list of strings into a Blob
612615str2float({expr} [, {quoted} ]) Float convert String to Float
613616str2list({expr} [, {utf8} ]) List convert each character of {expr} to
614617 ASCII/UTF-8 value
@@ -1241,7 +1244,7 @@ base64_decode({string}) *base64_decode()*
12411244 " Write the decoded contents to a binary file
12421245 call writefile(base64_decode(s), 'tools.bmp')
12431246 " Decode a base64-encoded string
1244- echo list2str(blob2list( base64_decode(encodedstr) ))
1247+ echo blob2str( base64_decode(encodedstr))
12451248<
12461249 Can also be used as a | method | : >
12471250 GetEncodedString()->base64_decode()
@@ -1257,7 +1260,7 @@ base64_encode({blob}) *base64_encode()*
12571260 " Encode the contents of a binary file
12581261 echo base64_encode(readblob('somefile.bin'))
12591262 " Encode a string
1260- echo base64_encode(list2blob(str2list( somestr) ))
1263+ echo base64_encode(str2blob([ somestr] ))
12611264<
12621265 Can also be used as a | method | : >
12631266 GetBinaryData()->base64_encode()
@@ -1289,6 +1292,42 @@ blob2list({blob}) *blob2list()*
12891292<
12901293 Return type: list<any> or list<number>
12911294
1295+
1296+ blob2str({blob} [, {options} ]) *blob2str()*
1297+ Return a List of Strings in the current 'encoding' by
1298+ converting the bytes in {blob} into characters.
1299+
1300+ Each <NL> byte in the blob is interpreted as the end of a
1301+ string and a new list item is added. Each <NUL> byte in the
1302+ blob is converted into a <NL> character.
1303+
1304+ If {options} is not supplied, the current 'encoding' value is
1305+ used to decode the bytes in {blob} .
1306+
1307+ The argument {options} is a | Dict | and supports the following
1308+ items:
1309+ encoding Decode the bytes in {blob} using this
1310+ encoding. The value is a | String | . See
1311+ | encoding-names | for the supported values.
1312+ *E1515*
1313+ An error is given and an empty List is returned if
1314+ an invalid byte sequence is encountered in {blob} ,
1315+
1316+ Returns an empty List if blob is empty.
1317+
1318+ See also | str2blob() |
1319+
1320+ Examples: >
1321+ blob2str(0z6162) returns ["ab"]
1322+ blob2str(0zC2ABC2BB) returns ["«»"]
1323+ blob2str(0zABBB, {'encoding': 'latin1'}) returns ["«»"]
1324+ <
1325+ Can also be used as a | method | : >
1326+ GetBlob()->blob2str()
1327+ <
1328+ Return type: list<string>
1329+
1330+
12921331 *browse()*
12931332browse({save} , {title} , {initdir} , {default} )
12941333 Put up a file requester. This only works when "has("browse")"
@@ -1911,7 +1950,8 @@ complete_info([{what}]) *complete_info()*
19111950 typed text only, or the last completion after
19121951 no item is selected when using the <Up> or
19131952 <Down> keys)
1914- inserted Inserted string. [NOT IMPLEMENTED YET]
1953+ completed Return a dictionary containing the entries of
1954+ the currently selected index item.
19151955
19161956 *complete_info_mode*
19171957 mode values are:
@@ -5002,12 +5042,12 @@ getstacktrace() *getstacktrace()*
50025042 Returns the current stack trace of Vim scripts.
50035043 Stack trace is a | List | , of which each item is a | Dictionary |
50045044 with the following items:
5005- funcref The funcref if the stack is at the function,
5006- otherwise this item is not exist .
5045+ funcref The funcref if the stack is at a function,
5046+ otherwise this item is omitted .
50075047 event The string of the event description if the
5008- stack is at autocmd event, otherwise this item
5009- is not exist .
5010- lnum The line number of the script on the stack.
5048+ stack is at an autocmd event, otherwise this
5049+ item is omitted .
5050+ lnum The line number in the script on the stack.
50115051 filepath The file path of the script on the stack.
50125052
50135053 Return type: list<dict<any> >
@@ -9038,7 +9078,7 @@ search({pattern} [, {flags} [, {stopline} [, {timeout} [, {skip}]]]])
90389078 's' Set the ' mark at the previous location of the cursor
90399079 'w' Wrap around the end of the file
90409080 'W' don't Wrap around the end of the file
9041- 'z' start searching at the cursor column instead of zero
9081+ 'z' start searching at the cursor column instead of Zero
90429082 If neither 'w' or 'W' is given, the 'wrapscan' option applies.
90439083
90449084 If the 's' flag is supplied, the ' mark is set, only if the
@@ -10556,6 +10596,42 @@ state([{what}]) *state()*
1055610596 Return type: | String |
1055710597
1055810598
10599+ str2blob({list} [, {options} ]) *str2blob()*
10600+ Return a Blob by converting the characters in the List of
10601+ strings in {list} into bytes.
10602+
10603+ A <NL> byte is added to the blob after each list item. A
10604+ newline character in the string is translated into a <NUL>
10605+ byte in the blob.
10606+
10607+ If {options} is not supplied, the current 'encoding' value is
10608+ used to convert the characters into bytes.
10609+
10610+ The argument {options} is a | Dict | and supports the following
10611+ items:
10612+ encoding Encode the characters using this encoding.
10613+ The value is a | String | . See | encoding-names |
10614+ for the supported values.
10615+
10616+ An error is given and an empty blob is returned if the
10617+ character encoding fails.
10618+
10619+ Returns an empty Blob if {list} is empty.
10620+
10621+ See also | blob2str() |
10622+
10623+ Examples: >
10624+ str2blob(["ab"]) returns 0z6162
10625+ str2blob(["«»"]) returns 0zC2ABC2BB
10626+ str2blob(["a\nb"]) returns 0z610A62
10627+ str2blob(readfile('myfile.txt'))
10628+ str2blob(["«»"], {'encoding': 'latin1'}) returns 0zABBB
10629+ <
10630+ Can also be used as a | method | : >
10631+ GetListOfStrings()->str2blob()
10632+ <
10633+ Return type: | Blob |
10634+
1055910635str2float({string} [, {quoted} ]) *str2float()*
1056010636 Convert String {string} to a Float. This mostly works the
1056110637 same as when using a floating point number in an expression,
0 commit comments