From 5a8684e7821a35e371b845b60699df527a855a9f Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 30 Jul 2005 22:43:24 +0000 Subject: updated for version 7.0120 --- runtime/doc/eval.txt | 113 +++++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 53 deletions(-) (limited to 'runtime/doc/eval.txt') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d11b77de4..be0b0ec3b 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2005 Jul 29 +*eval.txt* For Vim version 7.0aa. Last change: 2005 Jul 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -3341,14 +3341,14 @@ nr2char({expr}) *nr2char()* printf({fmt}, {expr1} ...) *printf()* Return a String with {fmt}, where "%" items are replaced by the formatted form of their respective arguments. Example: > - :echo printf("%4d: E%d %.30s", lnum, err, text) + printf("%4d: E%d %.30s", lnum, errno, msg) < May result in: - 99: E42 asdfasdfasdfasdfasdfasdfasdfas ~ + " 99: E42 asdfasdfasdfasdfasdfasdfasdfas" ~ Often used items are: %s string %6s string right-aligned in 6 characters - %c character + %c single byte %d decimal number %5d decimal number padded with spaces to 5 characters %x hex number @@ -3362,12 +3362,13 @@ printf({fmt}, {expr1} ...) *printf()* the result. The "%" starts a conversion specification. The following - arguments appear in sequence. Overview: + arguments appear in sequence: - % flags min-field-width .precision type + % [flags] [field-width] [.precision] type + + flags + Zero or more of the following flags: - - Zero or more of the following flags: - # The value should be converted to an "alternate form". For c, d, and s conversions, this option has no effect. For o conversions, the precision @@ -3378,85 +3379,91 @@ printf({fmt}, {expr1} ...) *printf()* For x and X conversions, a non-zero result has the string "0x" (or "0X" for X conversions) prepended to it. - + 0 (zero) Zero padding. For all conversions the converted value is padded on the left with zeros rather than blanks. If a precision is given with a numeric conversion (d, o, x, and X), the 0 flag is ignored. - + - A negative field width flag; the converted value is to be left adjusted on the field boundary. The converted value is padded on the right with blanks, rather than on the left with blanks or zeros. A - overrides a 0 if both are given. - + ' ' (space) A blank should be left before a positive number produced by a signed conversion (d). - + + A sign must always be placed before a number produced by a signed conversion. A + overrides a space if both are used. - - - An optional decimal digit string specifying a minimum - field width. If the converted value has fewer characters - than the field width, it will be padded with spaces on the - left (or right, if the left-adjustment flag has been - given) to fill out the field width. - - - An optional precision, in the form of a period '.' - followed by an optional digit string. If the digit string - is omitted, the precision is taken as zero. This gives - the minimum number of digits to appear for d, o, x, and X - conversions, or the maximum number of characters to be - printed from a string for s conversions. - - - A character that specifies the type of conversion to be - applied, see below. - + + field-width + An optional decimal digit string specifying a minimum + field width. If the converted value has fewer + characters than the field width, it will be padded + with spaces on the left (or right, if the + left-adjustment flag has been given) to fill out the + field width. + + .precision + An optional precision, in the form of a period '.' + followed by an optional digit string. If the digit + string is omitted, the precision is taken as zero. + This gives the minimum number of digits to appear for + d, o, x, and X conversions, or the maximum number of + characters to be printed from a string for s + conversions. + + type + A character that specifies the type of conversion to + be applied, see below. + A field width or precision, or both, may be indicated by an asterisk '*' instead of a digit string. In this case, a Number argument supplies the field width or precision. A negative field width is treated as a left adjustment flag followed by a positive field width; a negative precision is treated as though it were missing. Example: > - :echo printf("%d: %.*s", nr, columns, line) + :echo printf("%d: %.*s", nr, width, line) < This limits the length of the text used from "line" to - "columns" bytes. + "width" bytes. The conversion specifiers and their meanings are: - + doxX The Number argument is converted to signed decimal (d), unsigned octal (o), or unsigned hexadecimal (x and X) notation. The letters "abcdef" are used for x conversions; the letters "ABCDEF" are used for X - conversions. The precision, if any, gives the minimum - number of digits that must appear; if the converted - value requires fewer digits, it is padded on the left - with zeros. - - c The Number argument is converted to a byte, and - the resulting character is written. - - s The String argument is used. If a precision is - specified, no more bytes than the number specified are - written. - + conversions. + The precision, if any, gives the minimum number of + digits that must appear; if the converted value + requires fewer digits, it is padded on the left with + zeros. + In no case does a non-existent or small field width + cause truncation of a numeric field; if the result of + a conversion is wider than the field width, the field + is expanded to contain the conversion result. + + c The Number argument is converted to a byte, and the + resulting character is written. + + s The text of the String argument is used. If a + precision is specified, no more bytes than the number + specified are used. + % A '%' is written. No argument is converted. The complete conversion specification is "%%". - - Each argument can be Number or String and is converted - automatically to fit the conversion specifier. - In no case does a non-existent or small field width cause - truncation of a numeric field; if the result of a conversion - is wider than the field width, the field is expanded to - contain the conversion result. + Each argument can be Number or String and is converted + automatically to fit the conversion specifier. Any other + argument type results in an error message. *E766* *767* The number of {exprN} arguments must exactly match the number of "%" items. If there are not sufficient or too many - arguments an error is given. + arguments an error is given. Up to 18 arguments can be used. prevnonblank({lnum}) *prevnonblank()* @@ -4242,7 +4249,7 @@ taglist({expr}) *taglist()* information about these fields. For C code the fields "struct", "class" and "enum" may appear, they give the name of the entity the tag is contained in. - + The ex-command 'cmd' can be either an ex search pattern, a line number or a line number followed by a byte number. -- cgit v1.2.3