Mercurial > vim
comparison runtime/doc/eval.txt @ 17912:9fac6d0de69a v8.1.1952
patch 8.1.1952: more functions can be used as a method
Commit: https://github.com/vim/vim/commit/5d69fdb7c4b91faf2d92b8d449cc9460f3035fb3
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Aug 31 19:13:58 2019 +0200
patch 8.1.1952: more functions can be used as a method
Problem: More functions can be used as a method.
Solution: Allow more functions to be used as a method.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 31 Aug 2019 19:15:03 +0200 |
parents | cc953757ed2a |
children | af3d441845cd |
comparison
equal
deleted
inserted
replaced
17911:6ec211f84436 | 17912:9fac6d0de69a |
---|---|
1 *eval.txt* For Vim version 8.1. Last change: 2019 Aug 28 | 1 *eval.txt* For Vim version 8.1. Last change: 2019 Aug 31 |
2 | 2 |
3 | 3 |
4 VIM REFERENCE MANUAL by Bram Moolenaar | 4 VIM REFERENCE MANUAL by Bram Moolenaar |
5 | 5 |
6 | 6 |
5515 < | 5515 < |
5516 To obtain all window-local variables use: > | 5516 To obtain all window-local variables use: > |
5517 gettabwinvar({tabnr}, {winnr}, '&') | 5517 gettabwinvar({tabnr}, {winnr}, '&') |
5518 | 5518 |
5519 < Can also be used as a |method|: > | 5519 < Can also be used as a |method|: > |
5520 GetTabnr()->gettabvar(winnr, varname) | 5520 GetTabnr()->gettabwinvar(winnr, varname) |
5521 | 5521 |
5522 gettagstack([{nr}]) *gettagstack()* | 5522 gettagstack([{nr}]) *gettagstack()* |
5523 The result is a Dict, which is the tag stack of window {nr}. | 5523 The result is a Dict, which is the tag stack of window {nr}. |
5524 {nr} can be the window number or the |window-ID|. | 5524 {nr} can be the window number or the |window-ID|. |
5525 When {nr} is not specified, the current window is used. | 5525 When {nr} is not specified, the current window is used. |
5544 multiple matching tags are found for a | 5544 multiple matching tags are found for a |
5545 name. | 5545 name. |
5546 tagname name of the tag | 5546 tagname name of the tag |
5547 | 5547 |
5548 See |tagstack| for more information about the tag stack. | 5548 See |tagstack| for more information about the tag stack. |
5549 | |
5550 Can also be used as a |method|: > | |
5551 GetWinnr()->gettagstack() | |
5549 | 5552 |
5550 getwininfo([{winid}]) *getwininfo()* | 5553 getwininfo([{winid}]) *getwininfo()* |
5551 Returns information about windows as a List with Dictionaries. | 5554 Returns information about windows as a List with Dictionaries. |
5552 | 5555 |
5553 If {winid} is given Information about the window with that ID | 5556 If {winid} is given Information about the window with that ID |
5579 winid |window-ID| | 5582 winid |window-ID| |
5580 winnr window number | 5583 winnr window number |
5581 winrow topmost screen column of the window, | 5584 winrow topmost screen column of the window, |
5582 row from |win_screenpos()| | 5585 row from |win_screenpos()| |
5583 | 5586 |
5587 Can also be used as a |method|: > | |
5588 GetWinnr()->getwininfo() | |
5589 | |
5584 getwinpos([{timeout}]) *getwinpos()* | 5590 getwinpos([{timeout}]) *getwinpos()* |
5585 The result is a list with two numbers, the result of | 5591 The result is a list with two numbers, the result of |
5586 getwinposx() and getwinposy() combined: | 5592 getwinposx() and getwinposy() combined: |
5587 [x-pos, y-pos] | 5593 [x-pos, y-pos] |
5588 {timeout} can be used to specify how long to wait in msec for | 5594 {timeout} can be used to specify how long to wait in msec for |
5598 break | 5604 break |
5599 endif | 5605 endif |
5600 " Do some work here | 5606 " Do some work here |
5601 endwhile | 5607 endwhile |
5602 < | 5608 < |
5609 | |
5610 Can also be used as a |method|: > | |
5611 GetTimeout()->getwinpos() | |
5612 < | |
5603 *getwinposx()* | 5613 *getwinposx()* |
5604 getwinposx() The result is a Number, which is the X coordinate in pixels of | 5614 getwinposx() The result is a Number, which is the X coordinate in pixels of |
5605 the left hand side of the GUI Vim window. Also works for an | 5615 the left hand side of the GUI Vim window. Also works for an |
5606 xterm (uses a timeout of 100 msec). | 5616 xterm (uses a timeout of 100 msec). |
5607 The result will be -1 if the information is not available. | 5617 The result will be -1 if the information is not available. |
5617 getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* | 5627 getwinvar({winnr}, {varname} [, {def}]) *getwinvar()* |
5618 Like |gettabwinvar()| for the current tabpage. | 5628 Like |gettabwinvar()| for the current tabpage. |
5619 Examples: > | 5629 Examples: > |
5620 :let list_is_on = getwinvar(2, '&list') | 5630 :let list_is_on = getwinvar(2, '&list') |
5621 :echo "myvar = " . getwinvar(1, 'myvar') | 5631 :echo "myvar = " . getwinvar(1, 'myvar') |
5632 | |
5633 < Can also be used as a |method|: > | |
5634 GetWinnr()->getwinvar(varname) | |
5622 < | 5635 < |
5623 glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* | 5636 glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* |
5624 Expand the file wildcards in {expr}. See |wildcards| for the | 5637 Expand the file wildcards in {expr}. See |wildcards| for the |
5625 use of special characters. | 5638 use of special characters. |
5626 | 5639 |
5653 < The result of the program inside the backticks should be one | 5666 < The result of the program inside the backticks should be one |
5654 item per line. Spaces inside an item are allowed. | 5667 item per line. Spaces inside an item are allowed. |
5655 | 5668 |
5656 See |expand()| for expanding special Vim variables. See | 5669 See |expand()| for expanding special Vim variables. See |
5657 |system()| for getting the raw output of an external command. | 5670 |system()| for getting the raw output of an external command. |
5671 | |
5672 Can also be used as a |method|: > | |
5673 GetExpr()->glob() | |
5658 | 5674 |
5659 glob2regpat({expr}) *glob2regpat()* | 5675 glob2regpat({expr}) *glob2regpat()* |
5660 Convert a file pattern, as used by glob(), into a search | 5676 Convert a file pattern, as used by glob(), into a search |
5661 pattern. The result can be used to match with a string that | 5677 pattern. The result can be used to match with a string that |
5662 is a file name. E.g. > | 5678 is a file name. E.g. > |
5666 < When {expr} is an empty string the result is "^$", match an | 5682 < When {expr} is an empty string the result is "^$", match an |
5667 empty string. | 5683 empty string. |
5668 Note that the result depends on the system. On MS-Windows | 5684 Note that the result depends on the system. On MS-Windows |
5669 a backslash usually means a path separator. | 5685 a backslash usually means a path separator. |
5670 | 5686 |
5671 *globpath()* | 5687 Can also be used as a |method|: > |
5688 GetExpr()->glob2regpat() | |
5689 < *globpath()* | |
5672 globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) | 5690 globpath({path}, {expr} [, {nosuf} [, {list} [, {alllinks}]]]) |
5673 Perform glob() on all directories in {path} and concatenate | 5691 Perform glob() on all directories in {path} and concatenate |
5674 the results. Example: > | 5692 the results. Example: > |
5675 :echo globpath(&rtp, "syntax/c.vim") | 5693 :echo globpath(&rtp, "syntax/c.vim") |
5676 < | 5694 < |
5702 in 'runtimepath' and below: > | 5720 in 'runtimepath' and below: > |
5703 :echo globpath(&rtp, "**/README.txt") | 5721 :echo globpath(&rtp, "**/README.txt") |
5704 < Upwards search and limiting the depth of "**" is not | 5722 < Upwards search and limiting the depth of "**" is not |
5705 supported, thus using 'path' will not always work properly. | 5723 supported, thus using 'path' will not always work properly. |
5706 | 5724 |
5725 Can also be used as a |method|, the base is passed as the | |
5726 second argument: > | |
5727 GetExpr()->globpath(&rtp) | |
5728 < | |
5707 *has()* | 5729 *has()* |
5708 has({feature}) The result is a Number, which is 1 if the feature {feature} is | 5730 has({feature}) The result is a Number, which is 1 if the feature {feature} is |
5709 supported, zero otherwise. The {feature} argument is a | 5731 supported, zero otherwise. The {feature} argument is a |
5710 string. See |feature-list| below. | 5732 string. See |feature-list| below. |
5711 Also see |exists()|. | 5733 Also see |exists()|. |