comparison runtime/doc/eval.txt @ 449:3709cf52b9b5 v7.0119

updated for version 7.0119
author vimboss
date Fri, 29 Jul 2005 22:36:03 +0000
parents dd9db57ee7ce
children 01af1008a8d8
comparison
equal deleted inserted replaced
448:dd9db57ee7ce 449:3709cf52b9b5
1 *eval.txt* For Vim version 7.0aa. Last change: 2005 Jul 28 1 *eval.txt* For Vim version 7.0aa. Last change: 2005 Jul 29
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
1583 Number create directory {name} 1583 Number create directory {name}
1584 mode() String current editing mode 1584 mode() String current editing mode
1585 nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum} 1585 nextnonblank( {lnum}) Number line nr of non-blank line >= {lnum}
1586 nr2char( {expr}) String single char with ASCII value {expr} 1586 nr2char( {expr}) String single char with ASCII value {expr}
1587 prevnonblank( {lnum}) Number line nr of non-blank line <= {lnum} 1587 prevnonblank( {lnum}) Number line nr of non-blank line <= {lnum}
1588 printf( {fmt}, {expr1}...) String format text
1588 range( {expr} [, {max} [, {stride}]]) 1589 range( {expr} [, {max} [, {stride}]])
1589 List items from {expr} to {max} 1590 List items from {expr} to {max}
1590 readfile({fname} [, {binary} [, {max}]]) 1591 readfile({fname} [, {binary} [, {max}]])
1591 List get list of lines from file {fname} 1592 List get list of lines from file {fname}
1592 remote_expr( {server}, {string} [, {idvar}]) 1593 remote_expr( {server}, {string} [, {idvar}])
3334 nr2char(300) returns I with bow character 3335 nr2char(300) returns I with bow character
3335 < Note that a NUL character in the file is specified with 3336 < Note that a NUL character in the file is specified with
3336 nr2char(10), because NULs are represented with newline 3337 nr2char(10), because NULs are represented with newline
3337 characters. nr2char(0) is a real NUL and terminates the 3338 characters. nr2char(0) is a real NUL and terminates the
3338 string, thus results in an empty string. 3339 string, thus results in an empty string.
3340
3341 printf({fmt}, {expr1} ...) *printf()*
3342 Return a String with {fmt}, where "%" items are replaced by
3343 the formatted form of their respective arguments. Example: >
3344 :echo printf("%4d: E%d %.30s", lnum, err, text)
3345 < May result in:
3346 99: E42 asdfasdfasdfasdfasdfasdfasdfas ~
3347
3348 Often used items are:
3349 %s string
3350 %6s string right-aligned in 6 characters
3351 %c character
3352 %d decimal number
3353 %5d decimal number padded with spaces to 5 characters
3354 %x hex number
3355 %04x hex number padded with zeros to at least 4 characters
3356 %X hex number using upper case letters
3357 %o octal number
3358 %% the % character
3359
3360 Conversion specifications start with '%' and end with the
3361 conversion type. All other characters are copied unchanged to
3362 the result.
3363
3364 The "%" starts a conversion specification. The following
3365 arguments appear in sequence. Overview:
3366
3367 % flags min-field-width .precision type
3368
3369 - Zero or more of the following flags:
3370
3371 # The value should be converted to an "alternate
3372 form". For c, d, and s conversions, this option
3373 has no effect. For o conversions, the precision
3374 of the number is increased to force the first
3375 character of the output string to a zero (except
3376 if a zero value is printed with an explicit
3377 precision of zero).
3378 For x and X conversions, a non-zero result has
3379 the string "0x" (or "0X" for X conversions)
3380 prepended to it.
3381
3382 0 (zero) Zero padding. For all conversions the converted
3383 value is padded on the left with zeros rather
3384 than blanks. If a precision is given with a
3385 numeric conversion (d, o, x, and X), the 0 flag
3386 is ignored.
3387
3388 - A negative field width flag; the converted value
3389 is to be left adjusted on the field boundary.
3390 The converted value is padded on the right with
3391 blanks, rather than on the left with blanks or
3392 zeros. A - overrides a 0 if both are given.
3393
3394 ' ' (space) A blank should be left before a positive
3395 number produced by a signed conversion (d).
3396
3397 + A sign must always be placed before a number
3398 produced by a signed conversion. A + overrides
3399 a space if both are used.
3400
3401 - An optional decimal digit string specifying a minimum
3402 field width. If the converted value has fewer characters
3403 than the field width, it will be padded with spaces on the
3404 left (or right, if the left-adjustment flag has been
3405 given) to fill out the field width.
3406
3407 - An optional precision, in the form of a period '.'
3408 followed by an optional digit string. If the digit string
3409 is omitted, the precision is taken as zero. This gives
3410 the minimum number of digits to appear for d, o, x, and X
3411 conversions, or the maximum number of characters to be
3412 printed from a string for s conversions.
3413
3414 - A character that specifies the type of conversion to be
3415 applied, see below.
3416
3417 A field width or precision, or both, may be indicated by an
3418 asterisk '*' instead of a digit string. In this case, a
3419 Number argument supplies the field width or precision. A
3420 negative field width is treated as a left adjustment flag
3421 followed by a positive field width; a negative precision is
3422 treated as though it were missing. Example: >
3423 :echo printf("%d: %.*s", nr, columns, line)
3424 < This limits the length of the text used from "line" to
3425 "columns" bytes.
3426
3427 The conversion specifiers and their meanings are:
3428
3429 doxX The Number argument is converted to signed decimal
3430 (d), unsigned octal (o), or unsigned hexadecimal (x
3431 and X) notation. The letters "abcdef" are used for
3432 x conversions; the letters "ABCDEF" are used for X
3433 conversions. The precision, if any, gives the minimum
3434 number of digits that must appear; if the converted
3435 value requires fewer digits, it is padded on the left
3436 with zeros.
3437
3438 c The Number argument is converted to a byte, and
3439 the resulting character is written.
3440
3441 s The String argument is used. If a precision is
3442 specified, no more bytes than the number specified are
3443 written.
3444
3445 % A '%' is written. No argument is converted. The
3446 complete conversion specification is "%%".
3447
3448 Each argument can be Number or String and is converted
3449 automatically to fit the conversion specifier.
3450
3451 In no case does a non-existent or small field width cause
3452 truncation of a numeric field; if the result of a conversion
3453 is wider than the field width, the field is expanded to
3454 contain the conversion result.
3455
3456 *E766* *767*
3457 The number of {exprN} arguments must exactly match the number
3458 of "%" items. If there are not sufficient or too many
3459 arguments an error is given.
3460
3339 3461
3340 prevnonblank({lnum}) *prevnonblank()* 3462 prevnonblank({lnum}) *prevnonblank()*
3341 Return the line number of the first line at or above {lnum} 3463 Return the line number of the first line at or above {lnum}
3342 that is not blank. Example: > 3464 that is not blank. Example: >
3343 let ind = indent(prevnonblank(v:lnum - 1)) 3465 let ind = indent(prevnonblank(v:lnum - 1))