comparison runtime/doc/eval.txt @ 712:2e887dfa8917

updated for version 7.0214
author vimboss
date Sat, 04 Mar 2006 21:55:31 +0000
parents 111b7dcc8a17
children 0f9f4761ad9c
comparison
equal deleted inserted replaced
711:1babf94e0b24 712:2e887dfa8917
1 *eval.txt* For Vim version 7.0aa. Last change: 2006 Mar 03 1 *eval.txt* For Vim version 7.0aa. Last change: 2006 Mar 04
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
1716 wincol() Number window column of the cursor 1716 wincol() Number window column of the cursor
1717 winheight( {nr}) Number height of window {nr} 1717 winheight( {nr}) Number height of window {nr}
1718 winline() Number window line of the cursor 1718 winline() Number window line of the cursor
1719 winnr( [{expr}]) Number number of current window 1719 winnr( [{expr}]) Number number of current window
1720 winrestcmd() String returns command to restore window sizes 1720 winrestcmd() String returns command to restore window sizes
1721 winrestview({dict}) None restore view of current window
1722 winsaveview() Dict save view of current window
1721 winwidth( {nr}) Number width of window {nr} 1723 winwidth( {nr}) Number width of window {nr}
1722 writefile({list}, {fname} [, {binary}]) 1724 writefile({list}, {fname} [, {binary}])
1723 Number write list of lines to file {fname} 1725 Number write list of lines to file {fname}
1724 1726
1725 add({list}, {expr}) *add()* 1727 add({list}, {expr}) *add()*
3668 3670
3669 3671
3670 pumvisible() *pumvisible()* 3672 pumvisible() *pumvisible()*
3671 Returns non-zero when the popup menu is visible, zero 3673 Returns non-zero when the popup menu is visible, zero
3672 otherwise. See |ins-completion-menu|. 3674 otherwise. See |ins-completion-menu|.
3673 3675 This can be used to avoid some things that would remove the
3676 popup menu.
3674 3677
3675 *E726* *E727* 3678 *E726* *E727*
3676 range({expr} [, {max} [, {stride}]]) *range()* 3679 range({expr} [, {max} [, {stride}]]) *range()*
3677 Returns a |List| with Numbers: 3680 Returns a |List| with Numbers:
3678 - If only {expr} is specified: [0, 1, ..., {expr} - 1] 3681 - If only {expr} is specified: [0, 1, ..., {expr} - 1]
3856 Search for regexp pattern {pattern}. The search starts at the 3859 Search for regexp pattern {pattern}. The search starts at the
3857 cursor position (you can use |cursor()| to set it). 3860 cursor position (you can use |cursor()| to set it).
3858 3861
3859 {flags} is a String, which can contain these character flags: 3862 {flags} is a String, which can contain these character flags:
3860 'b' search backward instead of forward 3863 'b' search backward instead of forward
3864 'c' accept a match at the cursor position
3865 'e' move to the End of the match
3861 'n' do Not move the cursor 3866 'n' do Not move the cursor
3867 'p' return number of matching sub-pattern (see below)
3868 's' set the ' mark at the previous location of the cursor
3862 'w' wrap around the end of the file 3869 'w' wrap around the end of the file
3863 'W' don't wrap around the end of the file 3870 'W' don't wrap around the end of the file
3864 's' set the ' mark at the previous location of the cursor
3865 'c' accept a match at the cursor position
3866 If neither 'w' or 'W' is given, the 'wrapscan' option applies. 3871 If neither 'w' or 'W' is given, the 'wrapscan' option applies.
3867 3872
3868 If the 's' flag is supplied, the ' mark is set, only if the 3873 If the 's' flag is supplied, the ' mark is set, only if the
3869 cursor is moved. The 's' flag cannot be combined with the 'n' 3874 cursor is moved. The 's' flag cannot be combined with the 'n'
3870 flag. 3875 flag.
3875 let match = search('(', 'b', line("w0")) 3880 let match = search('(', 'b', line("w0"))
3876 let end = search('END', '', line("w$")) 3881 let end = search('END', '', line("w$"))
3877 < When {stopline} is used and it is not zero this also implies 3882 < When {stopline} is used and it is not zero this also implies
3878 that the search does not wrap around the end of the file. 3883 that the search does not wrap around the end of the file.
3879 3884
3880 When a match has been found its line number is returned. 3885 If there is no match a 0 is returned and the cursor doesn't
3886 move. No error message is given.
3887 When a match has been found its line number is returned. With
3888 the 'p' flag the returned value is one more than the first
3889 sub-match in \(\). One if there is none.
3890 To get the column number too use |searchpos()|.
3891
3881 The cursor will be positioned at the match, unless the 'n' 3892 The cursor will be positioned at the match, unless the 'n'
3882 flag is used. 3893 flag is used.
3883 If there is no match a 0 is returned and the cursor doesn't
3884 move. No error message is given.
3885 To get the column number too use |searchpos()|.
3886 3894
3887 Example (goes over all files in the argument list): > 3895 Example (goes over all files in the argument list): >
3888 :let n = 1 3896 :let n = 1
3889 :while n <= argc() " loop over all files in arglist 3897 :while n <= argc() " loop over all files in arglist
3890 : exe "argument " . n 3898 : exe "argument " . n
3898 : endwhile 3906 : endwhile
3899 : update " write the file if modified 3907 : update " write the file if modified
3900 : let n = n + 1 3908 : let n = n + 1
3901 :endwhile 3909 :endwhile
3902 < 3910 <
3911 Example for using some flags: >
3912 :echo search('\<if\|\(else\)\|\(endif\)', 'ncpe')
3913 < This will search for the keywords "if", "else", and "endif"
3914 under or after the cursor. Because of the 'p' flag, it
3915 returns 1, 2, or 3 depending on which keyword is found, or 0
3916 if the search fails. With the cursor on the first word of the
3917 line:
3918 if (foo == 0) | let foo = foo + 1 | endif ~
3919 the function returns 1. Without the 'c' flag, the function
3920 finds the "endif" and returns 3. The same thing happens
3921 without the 'e' flag if the cursor is on the "f" of "if".
3922 The 'n' flag tells the function not to move the cursor.
3923
3903 3924
3904 searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()* 3925 searchdecl({name} [, {global} [, {thisblock}]]) *searchdecl()*
3905 Search for the declaration of {name}. 3926 Search for the declaration of {name}.
3906 3927
3907 With a non-zero {global} argument it works like |gD|, find 3928 With a non-zero {global} argument it works like |gD|, find
3937 direction, but only when not in a nested start-end pair. A 3958 direction, but only when not in a nested start-end pair. A
3938 typical use is: > 3959 typical use is: >
3939 searchpair('\<if\>', '\<else\>', '\<endif\>') 3960 searchpair('\<if\>', '\<else\>', '\<endif\>')
3940 < By leaving {middle} empty the "else" is skipped. 3961 < By leaving {middle} empty the "else" is skipped.
3941 3962
3942 {flags} are used like with |search()|. Additionally: 3963 {flags} 'b', 'c', 'n', 's', 'w' and 'W' are used like with
3964 |search()|. Additionally:
3943 'r' Repeat until no more matches found; will find the 3965 'r' Repeat until no more matches found; will find the
3944 outer pair 3966 outer pair
3945 'm' return number of Matches instead of line number with 3967 'm' return number of Matches instead of line number with
3946 the match; will only be > 1 when 'r' is used. 3968 the match; will be > 1 when 'r' is used.
3947 3969
3948 When a match for {start}, {middle} or {end} is found, the 3970 When a match for {start}, {middle} or {end} is found, the
3949 {skip} expression is evaluated with the cursor positioned on 3971 {skip} expression is evaluated with the cursor positioned on
3950 the start of the match. It should return non-zero if this 3972 the start of the match. It should return non-zero if this
3951 match is to be skipped. E.g., because it is inside a comment 3973 match is to be skipped. E.g., because it is inside a comment
4762 |:wincmd|. 4784 |:wincmd|.
4763 4785
4764 *winrestcmd()* 4786 *winrestcmd()*
4765 winrestcmd() Returns a sequence of |:resize| commands that should restore 4787 winrestcmd() Returns a sequence of |:resize| commands that should restore
4766 the current window sizes. Only works properly when no windows 4788 the current window sizes. Only works properly when no windows
4767 are opened or closed and the current window is unchanged. 4789 are opened or closed and the current window and tab page is
4790 unchanged.
4768 Example: > 4791 Example: >
4769 :let cmd = winrestcmd() 4792 :let cmd = winrestcmd()
4770 :call MessWithWindowSizes() 4793 :call MessWithWindowSizes()
4771 :exe cmd 4794 :exe cmd
4795 <
4796 *winrestview()*
4797 winrestview({dict})
4798 Uses the |Dictionary| returned by |winsaveview()| to restore
4799 the view of the current window.
4800 If you have changed the values the result is unpredictable.
4801 If the window size changed the result won't be the same.
4802
4803 *winsaveview()*
4804 winsaveview() Returns a |Dictionary| that contains information to restore
4805 the view of the current window. Use |winrestview()| to
4806 restore the view.
4807 This is useful if you have a mapping that jumps around in the
4808 buffer and you want to go back to the original view.
4809 This does not save fold information. Use the 'foldenable'
4810 option to temporarily switch of folding, so that folds are not
4811 opened when moving around.
4812 The return value includes:
4813 lnum cursor line number
4814 col cursor column
4815 coladd cursor column offset for 'virtualedit'
4816 curswant column for vertical movement
4817 topline first line in the window
4818 topfill filler lines, only in diff mode
4819 leftcol first column displayed
4820 skipcol columns skipped
4821 Note that no option values are saved.
4822
4772 4823
4773 winwidth({nr}) *winwidth()* 4824 winwidth({nr}) *winwidth()*
4774 The result is a Number, which is the width of window {nr}. 4825 The result is a Number, which is the width of window {nr}.
4775 When {nr} is zero, the width of the current window is 4826 When {nr} is zero, the width of the current window is
4776 returned. When window {nr} doesn't exist, -1 is returned. 4827 returned. When window {nr} doesn't exist, -1 is returned.