Mercurial > vim
comparison runtime/doc/eval.txt @ 1661:5bbc2d6658ad v7.2a.013
updated for version 7.2a-013
author | vimboss |
---|---|
date | Fri, 04 Jul 2008 09:44:11 +0000 |
parents | 82b5078be2dd |
children | 0b796e045c42 |
comparison
equal
deleted
inserted
replaced
1660:a0c70314350f | 1661:5bbc2d6658ad |
---|---|
1854 setqflist( {list}[, {action}]) Number modify quickfix list using {list} | 1854 setqflist( {list}[, {action}]) Number modify quickfix list using {list} |
1855 setreg( {n}, {v}[, {opt}]) Number set register to value and type | 1855 setreg( {n}, {v}[, {opt}]) Number set register to value and type |
1856 settabwinvar( {tabnr}, {winnr}, {varname}, {val}) set {varname} in window | 1856 settabwinvar( {tabnr}, {winnr}, {varname}, {val}) set {varname} in window |
1857 {winnr} in tab page {tabnr} to {val} | 1857 {winnr} in tab page {tabnr} to {val} |
1858 setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val} | 1858 setwinvar( {nr}, {varname}, {val}) set {varname} in window {nr} to {val} |
1859 shellescape( {string}) String escape {string} for use as shell | 1859 shellescape( {string} [, {special}]) |
1860 String escape {string} for use as shell | |
1860 command argument | 1861 command argument |
1861 simplify( {filename}) String simplify filename as much as possible | 1862 simplify( {filename}) String simplify filename as much as possible |
1862 sin( {expr}) Float sine of {expr} | 1863 sin( {expr}) Float sine of {expr} |
1863 sort( {list} [, {func}]) List sort {list}, using {func} to compare | 1864 sort( {list} [, {func}]) List sort {list}, using {func} to compare |
1864 soundfold( {word}) String sound-fold {word} | 1865 soundfold( {word}) String sound-fold {word} |
4016 Not available on all systems. To check use: > | 4017 Not available on all systems. To check use: > |
4017 :if exists("*mkdir") | 4018 :if exists("*mkdir") |
4018 < | 4019 < |
4019 *mode()* | 4020 *mode()* |
4020 mode([expr]) Return a string that indicates the current mode. | 4021 mode([expr]) Return a string that indicates the current mode. |
4021 If [expr] is supplied and it evaluates to a non-zero number or | 4022 If [expr] is supplied and it evaluates to a non-zero Number or |
4022 a non-empty string, then the full mode is returned, otherwise | 4023 a non-empty String (|non-zero-arg|), then the full mode is |
4023 only the first letter is returned. Note that " " and "0" are | 4024 returned, otherwise only the first letter is returned. Note |
4024 also non-empty strings. | 4025 that " " and "0" are also non-empty strings. |
4025 | 4026 |
4026 n Normal | 4027 n Normal |
4027 no Operator-pending | 4028 no Operator-pending |
4028 v Visual by character | 4029 v Visual by character |
4029 V Visual by line | 4030 V Visual by line |
4939 Like |settabwinvar()| for the current tab page. | 4940 Like |settabwinvar()| for the current tab page. |
4940 Examples: > | 4941 Examples: > |
4941 :call setwinvar(1, "&list", 0) | 4942 :call setwinvar(1, "&list", 0) |
4942 :call setwinvar(2, "myvar", "foobar") | 4943 :call setwinvar(2, "myvar", "foobar") |
4943 | 4944 |
4944 shellescape({string}) *shellescape()* | 4945 shellescape({string} [, {special}]) *shellescape()* |
4945 Escape {string} for use as shell command argument. | 4946 Escape {string} for use as shell command argument. |
4946 On MS-Windows and MS-DOS, when 'shellslash' is not set, it | 4947 On MS-Windows and MS-DOS, when 'shellslash' is not set, it |
4947 will enclose {string} double quotes and double all double | 4948 will enclose {string} in double quotes and double all double |
4948 quotes within {string}. | 4949 quotes within {string}. |
4949 For other systems, it will enclose {string} in single quotes | 4950 For other systems, it will enclose {string} in single quotes |
4950 and replace all "'" with "'\''". | 4951 and replace all "'" with "'\''". |
4951 Example: > | 4952 When the {special} argument is present and it's a non-zero |
4952 :echo shellescape('c:\program files\vim') | 4953 Number or a non-empty String (|non-zero-arg|), then special |
4953 < results in: | 4954 items such as "%", "#" and "<cword>" will be preceded by a |
4954 "c:\program files\vim" ~ | 4955 backslash. This backslash will be removed again by the |:!| |
4955 Example usage: > | 4956 command. |
4956 :call system("chmod +x -- " . shellescape(expand("%"))) | 4957 Example of use with a |:!| command: > |
4958 :exe '!dir ' . shellescape(expand('<cfile>'), 1) | |
4959 < This results in a directory listing for the file under the | |
4960 cursor. Example of use with |system()|: > | |
4961 :call system("chmod +w -- " . shellescape(expand("%"))) | |
4957 | 4962 |
4958 | 4963 |
4959 simplify({filename}) *simplify()* | 4964 simplify({filename}) *simplify()* |
4960 Simplify the file name as much as possible without changing | 4965 Simplify the file name as much as possible without changing |
4961 the meaning. Shortcuts (on MS-Windows) or symbolic links (on | 4966 the meaning. Shortcuts (on MS-Windows) or symbolic links (on |
5331 Get the output of the shell command {expr}. | 5336 Get the output of the shell command {expr}. |
5332 When {input} is given, this string is written to a file and | 5337 When {input} is given, this string is written to a file and |
5333 passed as stdin to the command. The string is written as-is, | 5338 passed as stdin to the command. The string is written as-is, |
5334 you need to take care of using the correct line separators | 5339 you need to take care of using the correct line separators |
5335 yourself. Pipes are not used. | 5340 yourself. Pipes are not used. |
5336 Note: newlines in {expr} may cause the command to fail. The | 5341 Note: Use |shellescape()| to escape special characters in a |
5337 characters in 'shellquote' and 'shellxquote' may also cause | 5342 command argument. Newlines in {expr} may cause the command to |
5338 trouble. | 5343 fail. The characters in 'shellquote' and 'shellxquote' may |
5344 also cause trouble. | |
5339 This is not to be used for interactive commands. | 5345 This is not to be used for interactive commands. |
5346 | |
5340 The result is a String. Example: > | 5347 The result is a String. Example: > |
5341 | 5348 :let files = system("ls " . shellescape(expand('%:h'))) |
5342 :let files = system("ls") | |
5343 | 5349 |
5344 < To make the result more system-independent, the shell output | 5350 < To make the result more system-independent, the shell output |
5345 is filtered to replace <CR> with <NL> for Macintosh, and | 5351 is filtered to replace <CR> with <NL> for Macintosh, and |
5346 <CR><NL> with <NL> for DOS-like systems. | 5352 <CR><NL> with <NL> for DOS-like systems. |
5347 The command executed is constructed using several options: | 5353 The command executed is constructed using several options: |
5557 < This enters the same Visual mode as before. It is also useful | 5563 < This enters the same Visual mode as before. It is also useful |
5558 in scripts if you wish to act differently depending on the | 5564 in scripts if you wish to act differently depending on the |
5559 Visual mode that was used. | 5565 Visual mode that was used. |
5560 If Visual mode is active, use |mode()| to get the Visual mode | 5566 If Visual mode is active, use |mode()| to get the Visual mode |
5561 (e.g., in a |:vmap|). | 5567 (e.g., in a |:vmap|). |
5562 | 5568 *non-zero-arg* |
5563 If [expr] is supplied and it evaluates to a non-zero number or | 5569 If [expr] is supplied and it evaluates to a non-zero Number or |
5564 a non-empty string, then the Visual mode will be cleared and | 5570 a non-empty String, then the Visual mode will be cleared and |
5565 the old value is returned. Note that " " and "0" are also | 5571 the old value is returned. Note that " " and "0" are also |
5566 non-empty strings, thus cause the mode to be cleared. | 5572 non-empty strings, thus cause the mode to be cleared. A List, |
5573 Dictionary or Float is not a Number or String, thus does not | |
5574 cause the mode to be cleared. | |
5567 | 5575 |
5568 *winbufnr()* | 5576 *winbufnr()* |
5569 winbufnr({nr}) The result is a Number, which is the number of the buffer | 5577 winbufnr({nr}) The result is a Number, which is the number of the buffer |
5570 associated with window {nr}. When {nr} is zero, the number of | 5578 associated with window {nr}. When {nr} is zero, the number of |
5571 the buffer in the current window is returned. When window | 5579 the buffer in the current window is returned. When window |
6736 :execute "normal ixxx\<Esc>" | 6744 :execute "normal ixxx\<Esc>" |
6737 < This has an <Esc> character, see |expr-string|. | 6745 < This has an <Esc> character, see |expr-string|. |
6738 | 6746 |
6739 Be careful to correctly escape special characters in | 6747 Be careful to correctly escape special characters in |
6740 file names. The |fnameescape()| function can be used | 6748 file names. The |fnameescape()| function can be used |
6741 for this. Example: > | 6749 for Vim commands, |shellescape()| for |:!| commands. |
6750 Examples: > | |
6742 :execute "e " . fnameescape(filename) | 6751 :execute "e " . fnameescape(filename) |
6752 :execute "!ls " . shellescape(expand('%:h'), 1) | |
6743 < | 6753 < |
6744 Note: The executed string may be any command-line, but | 6754 Note: The executed string may be any command-line, but |
6745 you cannot start or end a "while", "for" or "if" | 6755 you cannot start or end a "while", "for" or "if" |
6746 command. Thus this is illegal: > | 6756 command. Thus this is illegal: > |
6747 :execute 'while i > 5' | 6757 :execute 'while i > 5' |