comparison runtime/doc/eval.txt @ 23788:d12ef361d9de v8.2.2435

patch 8.2.2435: setline() gives an error for some types Commit: https://github.com/vim/vim/commit/3445320839a38b3b0c253513b125da8298ec27d6 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 31 13:08:38 2021 +0100 patch 8.2.2435: setline() gives an error for some types Problem: setline() gives an error for some types. Solution: Allow any type, convert each item to a string.
author Bram Moolenaar <Bram@vim.org>
date Sun, 31 Jan 2021 13:15:04 +0100
parents 34b4eb3a8458
children 525c9e218c69
comparison
equal deleted inserted replaced
23787:7b30bc27e54b 23788:d12ef361d9de
1 *eval.txt* For Vim version 8.2. Last change: 2021 Jan 22 1 *eval.txt* For Vim version 8.2. Last change: 2021 Jan 31
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
291 :echo get(mylist, idx) 291 :echo get(mylist, idx)
292 :echo get(mylist, idx, "NONE") 292 :echo get(mylist, idx, "NONE")
293 293
294 294
295 List concatenation ~ 295 List concatenation ~
296 296 *list-concatenation*
297 Two lists can be concatenated with the "+" operator: > 297 Two lists can be concatenated with the "+" operator: >
298 :let longlist = mylist + [5, 6] 298 :let longlist = mylist + [5, 6]
299 :let mylist += [7, 8] 299 :let mylist += [7, 8]
300 300
301 To prepend or append an item turn the item into a list by putting [] around 301 To prepend or append an item, turn the item into a list by putting [] around
302 it. To change a list in-place see |list-modification| below. 302 it. To change a list in-place, refer to |list-modification| below.
303 303
304 304
305 Sublist ~ 305 Sublist ~
306 *sublist* 306 *sublist*
307 A part of the List can be obtained by specifying the first and last index, 307 A part of the List can be obtained by specifying the first and last index,
3131 append({lnum}, {text}) *append()* 3131 append({lnum}, {text}) *append()*
3132 When {text} is a |List|: Append each item of the |List| as a 3132 When {text} is a |List|: Append each item of the |List| as a
3133 text line below line {lnum} in the current buffer. 3133 text line below line {lnum} in the current buffer.
3134 Otherwise append {text} as one text line below line {lnum} in 3134 Otherwise append {text} as one text line below line {lnum} in
3135 the current buffer. 3135 the current buffer.
3136 Any type of item is accepted and converted to a String.
3136 {lnum} can be zero to insert a line before the first one. 3137 {lnum} can be zero to insert a line before the first one.
3137 Returns 1 for failure ({lnum} out of range or out of memory), 3138 Returns 1 for failure ({lnum} out of range or out of memory),
3138 0 for success. Example: > 3139 0 for success. Example: >
3139 :let failed = append(line('$'), "# THE END") 3140 :let failed = append(line('$'), "# THE END")
3140 :let failed = append(0, ["Chapter 1", "the beginning"]) 3141 :let failed = append(0, ["Chapter 1", "the beginning"])
9407 |setbufline()|. Any text properties in {lnum} are cleared. 9408 |setbufline()|. Any text properties in {lnum} are cleared.
9408 9409
9409 {lnum} is used like with |getline()|. 9410 {lnum} is used like with |getline()|.
9410 When {lnum} is just below the last line the {text} will be 9411 When {lnum} is just below the last line the {text} will be
9411 added below the last line. 9412 added below the last line.
9413 {text} can be any type or a List of any type, each item is
9414 converted to a String.
9412 9415
9413 If this succeeds, FALSE is returned. If this fails (most likely 9416 If this succeeds, FALSE is returned. If this fails (most likely
9414 because {lnum} is invalid) TRUE is returned. 9417 because {lnum} is invalid) TRUE is returned.
9415 9418
9416 Example: > 9419 Example: >