comparison runtime/doc/eval.txt @ 6341:094a87e76155 v7.4.503

updated for version 7.4.503 Problem: Cannot append a list of lines to a file. Solution: Add the append option to writefile(). (Yasuhiro Matsumoto)
author Bram Moolenaar <bram@vim.org>
date Wed, 05 Nov 2014 18:06:01 +0100
parents bd18da914be9
children c5d53d4c3e2e
comparison
equal deleted inserted replaced
6340:a72bf2c39633 6341:094a87e76155
2039 winnr( [{expr}]) Number number of current window 2039 winnr( [{expr}]) Number number of current window
2040 winrestcmd() String returns command to restore window sizes 2040 winrestcmd() String returns command to restore window sizes
2041 winrestview( {dict}) none restore view of current window 2041 winrestview( {dict}) none restore view of current window
2042 winsaveview() Dict save view of current window 2042 winsaveview() Dict save view of current window
2043 winwidth( {nr}) Number width of window {nr} 2043 winwidth( {nr}) Number width of window {nr}
2044 writefile( {list}, {fname} [, {binary}]) 2044 writefile( {list}, {fname} [, {flags}])
2045 Number write list of lines to file {fname} 2045 Number write list of lines to file {fname}
2046 xor( {expr}, {expr}) Number bitwise XOR 2046 xor( {expr}, {expr}) Number bitwise XOR
2047 2047
2048 abs({expr}) *abs()* 2048 abs({expr}) *abs()*
2049 Return the absolute value of {expr}. When {expr} evaluates to 2049 Return the absolute value of {expr}. When {expr} evaluates to
6553 :if winwidth(0) <= 50 6553 :if winwidth(0) <= 50
6554 : exe "normal 50\<C-W>|" 6554 : exe "normal 50\<C-W>|"
6555 :endif 6555 :endif
6556 < 6556 <
6557 *writefile()* 6557 *writefile()*
6558 writefile({list}, {fname} [, {binary}]) 6558 writefile({list}, {fname} [, {flags}])
6559 Write |List| {list} to file {fname}. Each list item is 6559 Write |List| {list} to file {fname}. Each list item is
6560 separated with a NL. Each list item must be a String or 6560 separated with a NL. Each list item must be a String or
6561 Number. 6561 Number.
6562 When {binary} is equal to "b" binary mode is used: There will 6562 When {flags} contains "b" then binary mode is used: There will
6563 not be a NL after the last list item. An empty item at the 6563 not be a NL after the last list item. An empty item at the
6564 end does cause the last line in the file to end in a NL. 6564 end does cause the last line in the file to end in a NL.
6565 All NL characters are replaced with a NUL character. 6565
6566 When {flags} contains "a" then append mode is used, lines are
6567 append to the file: >
6568 :call writefile(["foo"], "event.log", "a")
6569 :call writefile(["bar"], "event.log", "a")
6570 >
6571 < All NL characters are replaced with a NUL character.
6566 Inserting CR characters needs to be done before passing {list} 6572 Inserting CR characters needs to be done before passing {list}
6567 to writefile(). 6573 to writefile().
6568 An existing file is overwritten, if possible. 6574 An existing file is overwritten, if possible.
6569 When the write fails -1 is returned, otherwise 0. There is an 6575 When the write fails -1 is returned, otherwise 0. There is an
6570 error message if the file can't be created or when writing 6576 error message if the file can't be created or when writing