diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-09-02 19:45:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-09-02 19:45:19 +0200 |
commit | b31cf2bb0be95d106bd8eef93cc07550591c1d0d (patch) | |
tree | 21fe60ccae6ed5e12c50c564ad824d0d1a746742 /runtime/doc | |
parent | cf4b00c856ef714482d8d060332ac9a4d74e6b88 (diff) | |
download | vim-git-b31cf2bb0be95d106bd8eef93cc07550591c1d0d.tar.gz |
patch 8.0.1039: cannot change a line in not current bufferv8.0.1039
Problem: Cannot change a line in a buffer other than the current one.
Solution: Add setbufline(). (Yasuhiro Matsumoto, Ozaki Kiichi, closes #1953)
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/eval.txt | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index aea1cce3a..4eb68a0d7 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2316,6 +2316,9 @@ searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) server2client({clientid}, {string}) Number send reply string serverlist() String get a list of available servers +setbufline( {expr}, {lnum}, {line}) + Number set line {lnum} to {line} in buffer + {expr} setbufvar({expr}, {varname}, {val}) none set {varname} in buffer {expr} to {val} setcharsearch({dict}) Dict set character search from {dict} @@ -6858,6 +6861,19 @@ serverlist() *serverlist()* Example: > :echo serverlist() < +setbufline({expr}, {lnum}, {text}) *setbufline()* + Set line {lnum} to {text} in buffer {expr}. To insert + lines use |append()|. + + For the use of {expr}, see |bufname()| above. + + {lnum} is used like with |setline()|. + This works like |setline()| for the specified buffer. + On success 0 is returned, on failure 1 is returned. + + If {expr} is not a valid buffer or {lnum} is not valid, an + error message is given. + setbufvar({expr}, {varname}, {val}) *setbufvar()* Set option or local variable {varname} in buffer {expr} to {val}. @@ -6926,13 +6942,19 @@ setfperm({fname}, {mode}) *setfperm()* *chmod* setline({lnum}, {text}) *setline()* Set line {lnum} of the current buffer to {text}. To insert - lines use |append()|. + lines use |append()|. To set lines in another buffer use + |setbufline()|. + {lnum} is used like with |getline()|. When {lnum} is just below the last line the {text} will be added as a new line. + If this succeeds, 0 is returned. If this fails (most likely - because {lnum} is invalid) 1 is returned. Example: > + because {lnum} is invalid) 1 is returned. + + Example: > :call setline(5, strftime("%c")) + < When {text} is a |List| then line {lnum} and following lines will be set to the items in the list. Example: > :call setline(5, ['aaa', 'bbb', 'ccc']) |