Mercurial > vim
comparison runtime/doc/eval.txt @ 323:03b3684919e3 v7.0084
updated for version 7.0084
author | vimboss |
---|---|
date | Mon, 13 Jun 2005 22:28:56 +0000 |
parents | 529f887b5cb7 |
children | 8f38b35904c0 |
comparison
equal
deleted
inserted
replaced
322:a18bd33b8ea9 | 323:03b3684919e3 |
---|---|
1 *eval.txt* For Vim version 7.0aa. Last change: 2005 Jun 07 | 1 *eval.txt* For Vim version 7.0aa. Last change: 2005 Jun 11 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
232 :let blist = [1, 2, 3] | 232 :let blist = [1, 2, 3] |
233 :echo alist is blist | 233 :echo alist is blist |
234 < 0 > | 234 < 0 > |
235 :echo alist == blist | 235 :echo alist == blist |
236 < 1 | 236 < 1 |
237 | |
238 Note about comparing lists: Two lists are considered equal if they have the | |
239 same length and all items compare equal, as with using "==". There is one | |
240 exception: When comparing a number with a string and the string contains extra | |
241 characters beside the number they are not equal. Example: > | |
242 echo 4 == "4x" | |
243 < 1 > | |
244 echo [4] == ["4x"] | |
245 < 0 | |
246 | |
247 This is to fix the odd behavior of == that can't be changed for backward | |
248 compatibility reasons. | |
237 | 249 |
238 | 250 |
239 List unpack ~ | 251 List unpack ~ |
240 | 252 |
241 To unpack the items in a list to individual variables, put the variables in | 253 To unpack the items in a list to individual variables, put the variables in |
2591 the top of the GUI Vim window. The result will be -1 if the | 2603 the top of the GUI Vim window. The result will be -1 if the |
2592 information is not available. | 2604 information is not available. |
2593 | 2605 |
2594 getwinvar({nr}, {varname}) *getwinvar()* | 2606 getwinvar({nr}, {varname}) *getwinvar()* |
2595 The result is the value of option or local window variable | 2607 The result is the value of option or local window variable |
2596 {varname} in window {nr}. | 2608 {varname} in window {nr}. When {nr} is zero the current |
2609 window is used. | |
2597 This also works for a global option, buffer-local option and | 2610 This also works for a global option, buffer-local option and |
2598 window-local option, but it doesn't work for a global variable | 2611 window-local option, but it doesn't work for a global variable |
2599 or buffer-local variable. | 2612 or buffer-local variable. |
2600 Note that the name without "w:" must be used. | 2613 Note that the name without "w:" must be used. |
2601 Examples: > | 2614 Examples: > |
3690 nothing: > | 3703 nothing: > |
3691 :call setreg('a', '', 'al') | 3704 :call setreg('a', '', 'al') |
3692 | 3705 |
3693 setwinvar({nr}, {varname}, {val}) *setwinvar()* | 3706 setwinvar({nr}, {varname}, {val}) *setwinvar()* |
3694 Set option or local variable {varname} in window {nr} to | 3707 Set option or local variable {varname} in window {nr} to |
3695 {val}. | 3708 {val}. When {nr} is zero the current window is used. |
3696 This also works for a global or local buffer option, but it | 3709 This also works for a global or local buffer option, but it |
3697 doesn't work for a global or local buffer variable. | 3710 doesn't work for a global or local buffer variable. |
3698 For a local buffer option the global value is unchanged. | 3711 For a local buffer option the global value is unchanged. |
3699 Note that the variable name without "w:" must be used. | 3712 Note that the variable name without "w:" must be used. |
3700 Examples: > | 3713 Examples: > |
3802 {expr} type result ~ | 3815 {expr} type result ~ |
3803 String 'string' | 3816 String 'string' |
3804 Number 123 | 3817 Number 123 |
3805 Funcref function('name') | 3818 Funcref function('name') |
3806 List [item, item] | 3819 List [item, item] |
3820 Dictionary {key: value, key: value} | |
3807 Note that in String values the ' character is doubled. | 3821 Note that in String values the ' character is doubled. |
3808 | 3822 |
3809 *strlen()* | 3823 *strlen()* |
3810 strlen({expr}) The result is a Number, which is the length of the String | 3824 strlen({expr}) The result is a Number, which is the length of the String |
3811 {expr} in bytes. If you want to count the number of | 3825 {expr} in bytes. If you want to count the number of |