Mercurial > vim
comparison runtime/doc/eval.txt @ 782:d20041a02ee5
updated for version 7.0228
author | vimboss |
---|---|
date | Sat, 18 Mar 2006 21:40:56 +0000 |
parents | f664cc974a7a |
children | 8f6a426bc1e0 |
comparison
equal
deleted
inserted
replaced
781:afa9ef8a18a1 | 782:d20041a02ee5 |
---|---|
1 *eval.txt* For Vim version 7.0aa. Last change: 2006 Mar 17 | 1 *eval.txt* For Vim version 7.0aa. Last change: 2006 Mar 18 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
75 String "-8" --> Number -8 | 75 String "-8" --> Number -8 |
76 String "+8" --> Number 0 | 76 String "+8" --> Number 0 |
77 | 77 |
78 To force conversion from String to Number, add zero to it: > | 78 To force conversion from String to Number, add zero to it: > |
79 :echo "0100" + 0 | 79 :echo "0100" + 0 |
80 < 64 ~ | |
81 | |
82 To avoid a leading zero to cause octal conversion, or for using a different | |
83 base, use |str2nr()|. | |
80 | 84 |
81 For boolean operators Numbers are used. Zero is FALSE, non-zero is TRUE. | 85 For boolean operators Numbers are used. Zero is FALSE, non-zero is TRUE. |
82 | 86 |
83 Note that in the command > | 87 Note that in the command > |
84 :if "foo" | 88 :if "foo" |
1582 getwinvar( {nr}, {varname}) variable {varname} in window {nr} | 1586 getwinvar( {nr}, {varname}) variable {varname} in window {nr} |
1583 glob( {expr}) String expand file wildcards in {expr} | 1587 glob( {expr}) String expand file wildcards in {expr} |
1584 globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path} | 1588 globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path} |
1585 has( {feature}) Number TRUE if feature {feature} supported | 1589 has( {feature}) Number TRUE if feature {feature} supported |
1586 has_key( {dict}, {key}) Number TRUE if {dict} has entry {key} | 1590 has_key( {dict}, {key}) Number TRUE if {dict} has entry {key} |
1587 hasmapto( {what} [, {mode}]) Number TRUE if mapping to {what} exists | 1591 hasmapto( {what} [, {mode} [, {abbr}]]) |
1592 Number TRUE if mapping to {what} exists | |
1588 histadd( {history},{item}) String add an item to a history | 1593 histadd( {history},{item}) String add an item to a history |
1589 histdel( {history} [, {item}]) String remove an item from a history | 1594 histdel( {history} [, {item}]) String remove an item from a history |
1590 histget( {history} [, {index}]) String get the item {index} from a history | 1595 histget( {history} [, {index}]) String get the item {index} from a history |
1591 histnr( {history}) Number highest index of a history | 1596 histnr( {history}) Number highest index of a history |
1592 hlexists( {name}) Number TRUE if highlight group {name} exists | 1597 hlexists( {name}) Number TRUE if highlight group {name} exists |
1614 line( {expr}) Number line nr of cursor, last line or mark | 1619 line( {expr}) Number line nr of cursor, last line or mark |
1615 line2byte( {lnum}) Number byte count of line {lnum} | 1620 line2byte( {lnum}) Number byte count of line {lnum} |
1616 lispindent( {lnum}) Number Lisp indent for line {lnum} | 1621 lispindent( {lnum}) Number Lisp indent for line {lnum} |
1617 localtime() Number current time | 1622 localtime() Number current time |
1618 map( {expr}, {string}) List/Dict change each item in {expr} to {expr} | 1623 map( {expr}, {string}) List/Dict change each item in {expr} to {expr} |
1619 maparg( {name}[, {mode}]) String rhs of mapping {name} in mode {mode} | 1624 maparg( {name}[, {mode} [, {abbr}]]) |
1620 mapcheck( {name}[, {mode}]) String check for mappings matching {name} | 1625 String rhs of mapping {name} in mode {mode} |
1626 mapcheck( {name}[, {mode} [, {abbr}]]) | |
1627 String check for mappings matching {name} | |
1621 match( {expr}, {pat}[, {start}[, {count}]]) | 1628 match( {expr}, {pat}[, {start}[, {count}]]) |
1622 Number position where {pat} matches in {expr} | 1629 Number position where {pat} matches in {expr} |
1623 matchend( {expr}, {pat}[, {start}[, {count}]]) | 1630 matchend( {expr}, {pat}[, {start}[, {count}]]) |
1624 Number position where {pat} ends in {expr} | 1631 Number position where {pat} ends in {expr} |
1625 matchlist( {expr}, {pat}[, {start}[, {count}]]) | 1632 matchlist( {expr}, {pat}[, {start}[, {count}]]) |
1680 spellbadword() String badly spelled word at cursor | 1687 spellbadword() String badly spelled word at cursor |
1681 spellsuggest( {word} [, {max} [, {capital}]]) | 1688 spellsuggest( {word} [, {max} [, {capital}]]) |
1682 List spelling suggestions | 1689 List spelling suggestions |
1683 split( {expr} [, {pat} [, {keepempty}]]) | 1690 split( {expr} [, {pat} [, {keepempty}]]) |
1684 List make |List| from {pat} separated {expr} | 1691 List make |List| from {pat} separated {expr} |
1692 str2nr( {expr} [, {base}]) Number convert string to number | |
1685 strftime( {format}[, {time}]) String time in specified format | 1693 strftime( {format}[, {time}]) String time in specified format |
1686 stridx( {haystack}, {needle}[, {start}]) | 1694 stridx( {haystack}, {needle}[, {start}]) |
1687 Number index of {needle} in {haystack} | 1695 Number index of {needle} in {haystack} |
1688 string( {expr}) String String representation of {expr} value | 1696 string( {expr}) String String representation of {expr} value |
1689 strlen( {expr}) Number length of the String {expr} | 1697 strlen( {expr}) Number length of the String {expr} |
2894 has_key({dict}, {key}) *has_key()* | 2902 has_key({dict}, {key}) *has_key()* |
2895 The result is a Number, which is 1 if |Dictionary| {dict} has | 2903 The result is a Number, which is 1 if |Dictionary| {dict} has |
2896 an entry with key {key}. Zero otherwise. | 2904 an entry with key {key}. Zero otherwise. |
2897 | 2905 |
2898 | 2906 |
2899 hasmapto({what} [, {mode}]) *hasmapto()* | 2907 hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* |
2900 The result is a Number, which is 1 if there is a mapping that | 2908 The result is a Number, which is 1 if there is a mapping that |
2901 contains {what} in somewhere in the rhs (what it is mapped to) | 2909 contains {what} in somewhere in the rhs (what it is mapped to) |
2902 and this mapping exists in one of the modes indicated by | 2910 and this mapping exists in one of the modes indicated by |
2903 {mode}. | 2911 {mode}. |
2912 When {abbr} is there and it is non-zero use abbreviations | |
2913 instead of mappings. | |
2904 Both the global mappings and the mappings local to the current | 2914 Both the global mappings and the mappings local to the current |
2905 buffer are checked for a match. | 2915 buffer are checked for a match. |
2906 If no matching mapping is found 0 is returned. | 2916 If no matching mapping is found 0 is returned. |
2907 The following characters are recognized in {mode}: | 2917 The following characters are recognized in {mode}: |
2908 n Normal mode | 2918 n Normal mode |
3346 < Returns {expr}, the |List| or |Dictionary| that was filtered. | 3356 < Returns {expr}, the |List| or |Dictionary| that was filtered. |
3347 When an error is encountered while evaluating {string} no | 3357 When an error is encountered while evaluating {string} no |
3348 further items in {expr} are processed. | 3358 further items in {expr} are processed. |
3349 | 3359 |
3350 | 3360 |
3351 maparg({name}[, {mode}]) *maparg()* | 3361 maparg({name}[, {mode} [, {abbr}]]) *maparg()* |
3352 Return the rhs of mapping {name} in mode {mode}. When there | 3362 Return the rhs of mapping {name} in mode {mode}. When there |
3353 is no mapping for {name}, an empty String is returned. | 3363 is no mapping for {name}, an empty String is returned. |
3354 {mode} can be one of these strings: | 3364 {mode} can be one of these strings: |
3355 "n" Normal | 3365 "n" Normal |
3356 "v" Visual | 3366 "v" Visual |
3358 "i" Insert | 3368 "i" Insert |
3359 "c" Cmd-line | 3369 "c" Cmd-line |
3360 "l" langmap |language-mapping| | 3370 "l" langmap |language-mapping| |
3361 "" Normal, Visual and Operator-pending | 3371 "" Normal, Visual and Operator-pending |
3362 When {mode} is omitted, the modes for "" are used. | 3372 When {mode} is omitted, the modes for "" are used. |
3373 When {abbr} is there and it is non-zero use abbreviations | |
3374 instead of mappings. | |
3363 The {name} can have special key names, like in the ":map" | 3375 The {name} can have special key names, like in the ":map" |
3364 command. The returned String has special characters | 3376 command. The returned String has special characters |
3365 translated like in the output of the ":map" command listing. | 3377 translated like in the output of the ":map" command listing. |
3366 The mappings local to the current buffer are checked first, | 3378 The mappings local to the current buffer are checked first, |
3367 then the global mappings. | 3379 then the global mappings. |
3368 This function can be used to map a key even when it's already | 3380 This function can be used to map a key even when it's already |
3369 mapped, and have it do the original mapping too. Sketch: > | 3381 mapped, and have it do the original mapping too. Sketch: > |
3370 exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n') | 3382 exe 'nnoremap <Tab> ==' . maparg('<Tab>', 'n') |
3371 | 3383 |
3372 | 3384 |
3373 mapcheck({name}[, {mode}]) *mapcheck()* | 3385 mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()* |
3374 Check if there is a mapping that matches with {name} in mode | 3386 Check if there is a mapping that matches with {name} in mode |
3375 {mode}. See |maparg()| for {mode} and special names in | 3387 {mode}. See |maparg()| for {mode} and special names in |
3376 {name}. | 3388 {name}. |
3389 When {abbr} is there and it is non-zero use abbreviations | |
3390 instead of mappings. | |
3377 A match happens with a mapping that starts with {name} and | 3391 A match happens with a mapping that starts with {name} and |
3378 with a mapping which is equal to the start of {name}. | 3392 with a mapping which is equal to the start of {name}. |
3379 | 3393 |
3380 matches mapping "a" "ab" "abc" ~ | 3394 matches mapping "a" "ab" "abc" ~ |
3381 mapcheck("a") yes yes yes | 3395 mapcheck("a") yes yes yes |
4390 < ['abc:', 'def:', 'ghi'] ~ | 4404 < ['abc:', 'def:', 'ghi'] ~ |
4391 Splitting a table where the first element can be empty: > | 4405 Splitting a table where the first element can be empty: > |
4392 :let items = split(line, ':', 1) | 4406 :let items = split(line, ':', 1) |
4393 < The opposite function is |join()|. | 4407 < The opposite function is |join()|. |
4394 | 4408 |
4409 | |
4410 str2nr( {expr} [, {base}]) *str2nr()* | |
4411 Convert string {expr} to a number. | |
4412 {base} is the conversion base, it can be 8, 10 or 16. | |
4413 When {base} is omitted base 10 is used. This also means that | |
4414 a leading zero doesn't cause octal conversion to be used, as | |
4415 with the default String to Number conversion. | |
4416 When {base} is 16 a leading "0x" or "0X" is ignored. With a | |
4417 different base the result will be zero. | |
4418 Text after the number is silently ignored. | |
4419 | |
4395 | 4420 |
4396 strftime({format} [, {time}]) *strftime()* | 4421 strftime({format} [, {time}]) *strftime()* |
4397 The result is a String, which is a formatted date and time, as | 4422 The result is a String, which is a formatted date and time, as |
4398 specified by the {format} string. The given {time} is used, | 4423 specified by the {format} string. The given {time} is used, |
4399 or the current time if no time is given. The accepted | 4424 or the current time if no time is given. The accepted |