Mercurial > vim
comparison runtime/doc/eval.txt @ 5814:755931e042e4
Updated runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 05 Apr 2014 22:55:53 +0200 |
parents | e5f1f2ea0b4a |
children | d735e62f5925 |
comparison
equal
deleted
inserted
replaced
5813:870cb388ee8f | 5814:755931e042e4 |
---|---|
1 *eval.txt* For Vim version 7.4. Last change: 2014 Mar 27 | 1 *eval.txt* For Vim version 7.4. Last change: 2014 Apr 05 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
146 arguments: > | 146 arguments: > |
147 :let r = call(Fn, mylist) | 147 :let r = call(Fn, mylist) |
148 | 148 |
149 | 149 |
150 1.3 Lists ~ | 150 1.3 Lists ~ |
151 *List* *Lists* *E686* | 151 *list* *List* *Lists* *E686* |
152 A List is an ordered sequence of items. An item can be of any type. Items | 152 A List is an ordered sequence of items. An item can be of any type. Items |
153 can be accessed by their index number. Items can be added and removed at any | 153 can be accessed by their index number. Items can be added and removed at any |
154 position in the sequence. | 154 position in the sequence. |
155 | 155 |
156 | 156 |
392 example, to add up all the numbers in a list: > | 392 example, to add up all the numbers in a list: > |
393 :exe 'let sum = ' . join(nrlist, '+') | 393 :exe 'let sum = ' . join(nrlist, '+') |
394 | 394 |
395 | 395 |
396 1.4 Dictionaries ~ | 396 1.4 Dictionaries ~ |
397 *Dictionaries* *Dictionary* | 397 *dict* *Dictionaries* *Dictionary* |
398 A Dictionary is an associative array: Each entry has a key and a value. The | 398 A Dictionary is an associative array: Each entry has a key and a value. The |
399 entry can be located with the key. The entries are stored without a specific | 399 entry can be located with the key. The entries are stored without a specific |
400 ordering. | 400 ordering. |
401 | 401 |
402 | 402 |
1003 :echo printf('%.15e', atan(1)) | 1003 :echo printf('%.15e', atan(1)) |
1004 < 7.853981633974483e-01 | 1004 < 7.853981633974483e-01 |
1005 | 1005 |
1006 | 1006 |
1007 | 1007 |
1008 string *expr-string* *E114* | 1008 string *string* *expr-string* *E114* |
1009 ------ | 1009 ------ |
1010 "string" string constant *expr-quote* | 1010 "string" string constant *expr-quote* |
1011 | 1011 |
1012 Note that double quotes are used. | 1012 Note that double quotes are used. |
1013 | 1013 |
1142 |tabpage-variable| t: Local to the current tab page. | 1142 |tabpage-variable| t: Local to the current tab page. |
1143 |global-variable| g: Global. | 1143 |global-variable| g: Global. |
1144 |local-variable| l: Local to a function. | 1144 |local-variable| l: Local to a function. |
1145 |script-variable| s: Local to a |:source|'ed Vim script. | 1145 |script-variable| s: Local to a |:source|'ed Vim script. |
1146 |function-argument| a: Function argument (only inside a function). | 1146 |function-argument| a: Function argument (only inside a function). |
1147 |vim-variable| v: Global, predefined by Vim. | 1147 |vim-variable| v: Global, predefined by Vim. |
1148 | 1148 |
1149 The scope name by itself can be used as a |Dictionary|. For example, to | 1149 The scope name by itself can be used as a |Dictionary|. For example, to |
1150 delete all script-local variables: > | 1150 delete all script-local variables: > |
1151 :for k in keys(s:) | 1151 :for k in keys(s:) |
1152 : unlet s:[k] | 1152 : unlet s:[k] |
2718 If {expr} is an executable and is either an absolute path, a | 2718 If {expr} is an executable and is either an absolute path, a |
2719 relative path or found in $PATH, return the full path. | 2719 relative path or found in $PATH, return the full path. |
2720 Note that the current directory is used when {expr} starts | 2720 Note that the current directory is used when {expr} starts |
2721 with "./", which may be a problem for Vim: > | 2721 with "./", which may be a problem for Vim: > |
2722 echo exepath(v:progpath) | 2722 echo exepath(v:progpath) |
2723 < If {expr} cannot be found in $PATH or is not executable then | 2723 < If {expr} cannot be found in $PATH or is not executable then |
2724 an empty string is returned. | 2724 an empty string is returned. |
2725 | 2725 |
2726 *exists()* | 2726 *exists()* |
2727 exists({expr}) The result is a Number, which is non-zero if {expr} is | 2727 exists({expr}) The result is a Number, which is non-zero if {expr} is |
2728 defined, zero otherwise. The {expr} argument is a string, | 2728 defined, zero otherwise. The {expr} argument is a string, |
6453 :if has("cindent") | 6453 :if has("cindent") |
6454 2. Features that are only supported when certain conditions have been met. | 6454 2. Features that are only supported when certain conditions have been met. |
6455 Example: > | 6455 Example: > |
6456 :if has("gui_running") | 6456 :if has("gui_running") |
6457 < *has-patch* | 6457 < *has-patch* |
6458 3. Included patches. First check |v:version| for the version of Vim. | 6458 3. Included patches. The "patch123" feature means that patch 123 has been |
6459 Then the "patch123" feature means that patch 123 has been included for | 6459 included. Note that this form does not check the version of Vim, you need |
6460 this version. Example (checking version 6.2.148 or later): > | 6460 to inspect |v:version| for that. |
6461 Example (checking version 6.2.148 or later): > | |
6461 :if v:version > 602 || v:version == 602 && has("patch148") | 6462 :if v:version > 602 || v:version == 602 && has("patch148") |
6462 < Note that it's possible for patch 147 to be omitted even though 148 is | 6463 < Note that it's possible for patch 147 to be omitted even though 148 is |
6464 included. | |
6465 | |
6466 4. Beyond a certain version or at a certain version and including a specific | |
6467 patch. The "patch-7.4.123" feature means that the Vim version is 7.5 or | |
6468 later, or it is version 7.4 and patch 123 was included. | |
6469 The example above can be simplified to: > | |
6470 :if has("patch-6.2.148") | |
6471 < Note that it's possible for patch 147 to be omitted even though 148 is | |
6463 included. | 6472 included. |
6464 | 6473 |
6465 acl Compiled with |ACL| support. | 6474 acl Compiled with |ACL| support. |
6466 all_builtin_terms Compiled with all builtin terminals enabled. | 6475 all_builtin_terms Compiled with all builtin terminals enabled. |
6467 amiga Amiga version of Vim. | 6476 amiga Amiga version of Vim. |
7400 < | 7409 < |
7401 Another character can be used instead of / around the | 7410 Another character can be used instead of / around the |
7402 {pattern}, so long as it does not have a special | 7411 {pattern}, so long as it does not have a special |
7403 meaning (e.g., '|' or '"') and doesn't occur inside | 7412 meaning (e.g., '|' or '"') and doesn't occur inside |
7404 {pattern}. | 7413 {pattern}. |
7414 Information about the exception is available in | |
7415 |v:exception|. Also see |throw-variables|. | |
7405 NOTE: It is not reliable to ":catch" the TEXT of | 7416 NOTE: It is not reliable to ":catch" the TEXT of |
7406 an error message because it may vary in different | 7417 an error message because it may vary in different |
7407 locales. | 7418 locales. |
7408 | 7419 |
7409 *:fina* *:finally* *E606* *E607* | 7420 *:fina* *:finally* *E606* *E607* |