aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/eval.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/eval.txt')
-rw-r--r--runtime/doc/eval.txt108
1 files changed, 81 insertions, 27 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 476ab71461..933c4decee 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.4. Last change: 2015 Sep 19
+*eval.txt* For Vim version 7.4. Last change: 2016 Jan 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1788,9 +1788,10 @@ arglistid( [{winnr} [, {tabnr}]])
Number argument list id
argv( {nr}) String {nr} entry of the argument list
argv( ) List the argument list
-assert_equal( {exp}, {act} [, {msg}]) none assert that {exp} equals {act}
-assert_false( {actual} [, {msg}]) none assert that {actual} is false
-assert_true( {actual} [, {msg}]) none assert that {actual} is true
+assert_equal( {exp}, {act} [, {msg}]) none assert {exp} equals {act}
+assert_exception({error} [, {msg}]) none assert {error} is in v:exception
+assert_false( {actual} [, {msg}]) none assert {actual} is false
+assert_true( {actual} [, {msg}]) none assert {actual} is true
asin( {expr}) Float arc sine of {expr}
atan( {expr}) Float arc tangent of {expr}
atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2}
@@ -1830,7 +1831,7 @@ cursor( {lnum}, {col} [, {off}])
Number move cursor to {lnum}, {col}, {off}
cursor( {list}) Number move cursor to position in {list}
deepcopy( {expr} [, {noref}]) any make a full copy of {expr}
-delete( {fname}) Number delete file {fname}
+delete( {fname} [, {flags}]) Number delete the file or directory {fname}
dictwatcheradd( {dict}, {pattern}, {callback})
Start watching a dictionary
dictwatcherdel( {dict}, {pattern}, {callback})
@@ -1886,7 +1887,7 @@ getcmdpos() Number return cursor position in command-line
getcmdtype() String return current command-line type
getcmdwintype() String return current command-line window type
getcurpos() List position of the cursor
-getcwd() String the current working directory
+getcwd( [{scope}]) String the current working directory
getfontname( [{name}]) String name of font being used
getfperm( {fname}) String file permissions of file {fname}
getfsize( {fname}) Number size in bytes of file {fname}
@@ -2244,7 +2245,20 @@ assert_equal({expected}, {actual}, [, {msg}])
< Will result in a string to be added to |v:errors|:
test.vim line 12: Expected 'foo' but got 'bar' ~
-assert_false({actual}, [, {msg}]) *assert_false()*
+assert_exception({error} [, {msg}]) *assert_exception()*
+ When v:exception does not contain the string {error} an error
+ message is added to |v:errors|.
+ This can be used to assert that a command throws an exception.
+ Using the error number, followed by a colon, avoids problems
+ with translations: >
+ try
+ commandthatfails
+ call assert_false(1, 'command should have failed')
+ catch
+ call assert_exception('E492:')
+ endtry
+
+assert_false({actual} [, {msg}]) *assert_false()*
When {actual} is not false an error message is added to
|v:errors|, like with |assert_equal()|.
A value is false when it is zero or |v:false|. When "{actual}"
@@ -2252,7 +2266,7 @@ assert_false({actual}, [, {msg}]) *assert_false()*
When {msg} is omitted an error in the form "Expected False but
got {actual}" is produced.
-assert_true({actual}, [, {msg}]) *assert_true()*
+assert_true({actual} [, {msg}]) *assert_true()*
When {actual} is not true an error message is added to
|v:errors|, like with |assert_equal()|.
A value is true when it is a non-zero number or |v:true|.
@@ -2770,13 +2784,19 @@ deepcopy({expr}[, {noref}]) *deepcopy()* *E698*
{noref} set to 1 will fail.
Also see |copy()|.
-delete({fname}) *delete()*
- Deletes the file by the name {fname}. The result is a Number,
- which is 0 if the file was deleted successfully, and non-zero
- when the deletion failed.
- Use |remove()| to delete an item from a |List|.
- To delete a line from the buffer use |:delete|. Use |:exe|
- when the line number is in a variable.
+delete({fname} [, {flags}]) *delete()*
+ Without {flags} or with {flags} empty: Deletes the file by the
+ name {fname}. This also works when {fname} is a symbolic link.
+ A symbolic link itself is deleted, not what it points to.
+
+ When {flags} is "d": Deletes the directory by the name
+ {fname}. This fails when directory {fname} is not empty.
+
+ When {flags} is "rf": Deletes the directory by the name
+ {fname} and everything in it, recursively. BE CAREFUL!
+
+ The result is a Number, which is 0 if the delete operation was
+ successful and -1 when the deletion failed or partly failed.
dictwatcheradd({dict}, {pattern}, {callback}) *dictwatcheradd()*
Adds a watcher to a dictionary. A dictionary watcher is
@@ -3559,9 +3579,18 @@ getcurpos() Get the position of the cursor. This is like getpos('.'), but
MoveTheCursorAround
call setpos('.', save_cursor)
<
- *getcwd()*
-getcwd() The result is a String, which is the name of the current
- working directory.
+getcwd([{window}[, {tab}]]) *getcwd()*
+ With no arguments the result is a String, which is the name of
+ the current effective working directory. With {window} or
+ {tab} the working directory of that scope is returned.
+ Tabs and windows are identified by their respective numbers,
+ 0 means current tab or window. Missing argument implies 0.
+ Thus the following are equivalent: >
+ getcwd()
+ getcwd(0)
+ getcwd(0, 0)
+< If {window} is -1 it is ignored, only the tab is resolved.
+
getfsize({fname}) *getfsize()*
The result is a Number, which is the size in bytes of the
@@ -3896,9 +3925,18 @@ has_key({dict}, {key}) *has_key()*
The result is a Number, which is 1 if |Dictionary| {dict} has
an entry with key {key}. Zero otherwise.
-haslocaldir() *haslocaldir()*
- The result is a Number, which is 1 when the current
- window has set a local path via |:lcd|, and 0 otherwise.
+haslocaldir([{window}[, {tab}]]) *haslocaldir()*
+ The result is a Number, which is 1 when the specified tabpage
+ or window has a local path set via |:lcd| or |:tcd|, and
+ 0 otherwise.
+
+ Tabs and windows are identified by their respective numbers,
+ 0 means current tab or window. Missing argument implies 0.
+ Thus the following are equivalent: >
+ haslocaldir()
+ haslocaldir(0)
+ haslocaldir(0, 0)
+< If {window} is -1 it is ignored, only the tab is resolved.
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
The result is a Number, which is 1 if there is a mapping that
@@ -5524,14 +5562,15 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()*
move. No error message is given.
{flags} is a String, which can contain these character flags:
- 'b' search backward instead of forward
- 'c' accept a match at the cursor position
+ 'b' search Backward instead of forward
+ 'c' accept a match at the Cursor position
'e' move to the End of the match
'n' do Not move the cursor
- 'p' return number of matching sub-pattern (see below)
- 's' set the ' mark at the previous location of the cursor
- 'w' wrap around the end of the file
- 'W' don't wrap around the end of the file
+ 'p' return number of matching sub-Pattern (see below)
+ 's' Set the ' mark at the previous location of the cursor
+ 'w' Wrap around the end of the file
+ 'W' don't Wrap around the end of the file
+ 'z' start searching at the cursor column instead of Zero
If neither 'w' or 'W' is given, the 'wrapscan' option applies.
If the 's' flag is supplied, the ' mark is set, only if the
@@ -5539,6 +5578,12 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()*
flag.
'ignorecase', 'smartcase' and 'magic' are used.
+
+ When the 'z' flag is not given seaching always starts in
+ column zero and then matches before the cursor are skipped.
+ When the 'c' flag is present in 'cpo' the next search starts
+ after the match. Without the 'c' flag the next search starts
+ one column further.
When the {stopline} argument is given then the search stops
after searching this line. This is useful to restrict the
@@ -6120,6 +6165,10 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
strtod() function to parse numbers, Strings, Lists, Dicts and
Funcrefs will be considered as being 0).
+ When {func} is given and it is 'N' then all items will be
+ sorted numerical. This is like 'n' but a string containing
+ digits will be used as the number they represent.
+
When {func} is a |Funcref| or a function name, this function
is called to compare items. The function is invoked with two
items as argument and must return zero if they are equal, 1 or
@@ -6134,6 +6183,11 @@ sort({list} [, {func} [, {dict}]]) *sort()* *E702*
on numbers, text strings will sort next to each other, in the
same order as they were originally.
+ The sort is stable, items which compare equal (as number or as
+ string) will keep their relative position. E.g., when sorting
+ on numbers, text strings will sort next to each other, in the
+ same order as they were originally.
+
Also see |uniq()|.
Example: >