Skip to content

Commit ca85159

Browse files
committed
patch 8.1.0037: cannot easily append lines to another buffer
Problem: Cannot easily append lines to another buffer. Solution: Add appendbufline().
1 parent 891e1fd commit ca85159

5 files changed

Lines changed: 201 additions & 168 deletions

File tree

runtime/doc/eval.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,6 +2560,21 @@ append({lnum}, {expr}) *append()*
25602560
0 for success. Example: >
25612561
:let failed = append(line('$'), "# THE END")
25622562
:let failed = append(0, ["Chapter 1", "the beginning"])
2563+
2564+
appendbufline({expr}, {lnum}, {text}) *appendbufline()*
2565+
Like |append()| but append the text in buffer {expr}.
2566+
2567+
For the use of {expr}, see |bufname()|.
2568+
2569+
{lnum} is used like with |append()|. Note that using |line()|
2570+
would use the current buffer, not the one appending to.
2571+
Use "$" to append at the end of the buffer.
2572+
2573+
On success 0 is returned, on failure 1 is returned.
2574+
2575+
If {expr} is not a valid buffer or {lnum} is not valid, an
2576+
error message is given. Example: >
2577+
:let failed = appendbufline(13, 0, "# THE START")
25632578
<
25642579
*argc()*
25652580
argc() The result is the number of files in the argument list of the

0 commit comments

Comments
 (0)