forked from aniani/vim
updated for version 7.0039
This commit is contained in:
parent
6d14ccda51
commit
2fda12f0fa
@ -1,4 +1,4 @@
|
||||
*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 14
|
||||
*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 15
|
||||
|
||||
|
||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||
@ -117,7 +117,7 @@ arguments: >
|
||||
|
||||
|
||||
1.3 Lists ~
|
||||
*List* *E686*
|
||||
*List* *E686* *E712*
|
||||
A List is an ordered sequence of items. An item can be of any type. Items
|
||||
can be accessed by their index number. Items can be added and removed at any
|
||||
position in the sequence.
|
||||
@ -261,7 +261,7 @@ examples: >
|
||||
:call extend(list, [1, 2]) " extend the list with two more items
|
||||
:let i = remove(list, 3) " remove item 3
|
||||
:let l = remove(list, 3, -1) " remove items 3 to last item
|
||||
:call filter(list, '& =~ "x"') " remove items with an 'x'
|
||||
:call filter(list, 'v:val =~ "x"') " remove items with an 'x'
|
||||
|
||||
Changing the oder of items in a list: >
|
||||
:call sort(list) " sort a list alphabetically
|
||||
@ -314,17 +314,17 @@ List functions ~
|
||||
Functions that are useful with a List: >
|
||||
:let r = call(funcname, list) " call a function with an argument list
|
||||
:if empty(list) " check if list is empty
|
||||
:let l = len(list) " number of items in a list
|
||||
:let big = max(list) " maximum value in a list
|
||||
:let small = min(list) " minimum value in a list
|
||||
:let l = len(list) " number of items in list
|
||||
:let big = max(list) " maximum value in list
|
||||
:let small = min(list) " minimum value in list
|
||||
:let xs = count(list, 'x') " count nr of times 'x' appears in list
|
||||
:let i = index(list, 'x') " index of first 'x' in list
|
||||
:let lines = getline(1, 10) " get ten text lines from buffer
|
||||
:call append('$', lines) " append text lines in buffer
|
||||
:let list = split("a b c") " create list from items in a string
|
||||
:let string = join(list, ', ') " create string from list items
|
||||
:let s = string() " String representation of a list
|
||||
:call map(list, '">> " . &') " prepend ">> " to each item
|
||||
:let s = string(list) " String representation of list
|
||||
:call map(list, '">> " . v:val') " prepend ">> " to each item
|
||||
|
||||
|
||||
1.4 Dictionaries ~
|
||||
@ -423,7 +423,44 @@ Merging a Dictionary with another is done with |extend()|: >
|
||||
:call extend(adict, bdict) " extend adict with entries from bdict
|
||||
|
||||
Weeding out entries from a Dictionary can be done with |filter()|: >
|
||||
:call filter(dict '& =~ "x"') " remove entries with value 'x'
|
||||
:call filter(dict 'v:val =~ "x"') " remove entries with value 'x'
|
||||
|
||||
|
||||
Dictionary function ~
|
||||
*Dictionary-function* *self*
|
||||
When a function is defined with the "dict" attribute it can be used in a
|
||||
special way with a dictionary. Example: >
|
||||
:function Mylen() dict
|
||||
: return len(self) - 4
|
||||
:endfunction
|
||||
:let dict.len = function(Mylen)
|
||||
:let l = dict.len()
|
||||
|
||||
This is like a method in object oriented programming. The entry in the
|
||||
Dictionary is a |Funcref|. The local variable "self" refers to the dictionary
|
||||
the function was invoked from.
|
||||
|
||||
To avoid the extra name for the function it can be defined and directly
|
||||
assigned to a Dictionary in this way: >
|
||||
:function dict.len() dict
|
||||
: return len(self) - 4
|
||||
:endfunction
|
||||
|
||||
It is also possible to add a Funcref to a Dictionary without the "dict"
|
||||
attribute, but the "self" variable is not available then.
|
||||
|
||||
|
||||
Functions for Dictionaries ~
|
||||
|
||||
Functions that are useful with a Dictionary: >
|
||||
:if has_key(dict, 'foo') " TRUE if dict has entry with key "foo"
|
||||
:if empty(dict) " TRUE if dict is empty
|
||||
:let l = len(dict) " number of items in dict
|
||||
:let big = max(dict) " maximum value in dict
|
||||
:let small = min(dict) " minimum value in dict
|
||||
:let xs = count(dict, 'x') " count nr of times 'x' appears in dict
|
||||
:let s = string(dict) " String representation of dict
|
||||
:call map(dict, '">> " . v:val') " prepend ">> " to each item
|
||||
|
||||
|
||||
1.5 More about variables ~
|
||||
@ -487,16 +524,18 @@ Expression syntax summary, from least to most significant:
|
||||
|expr7| ! expr7 logical NOT
|
||||
- expr7 unary minus
|
||||
+ expr7 unary plus
|
||||
expr8
|
||||
|
||||
|expr8| expr9[expr1] byte of a String or item of a List
|
||||
expr9[expr1 : expr2] substring of a String or sublist of a List
|
||||
expr9.name entry in a Dictionary
|
||||
|
||||
|expr8| expr8[expr1] byte of a String or item of a List
|
||||
expr8[expr1 : expr1] substring of a String or sublist of a List
|
||||
expr8.name entry in a Dictionary
|
||||
expr8(expr1, ...) function call with Funcref variable
|
||||
|
||||
|expr9| number number constant
|
||||
"string" string constant, backslash is special
|
||||
'string' string constant, ' is doubled
|
||||
[expr1, ...] List
|
||||
{expr1: expr1, ...} Dictionary
|
||||
&option option value
|
||||
(expr1) nested expression
|
||||
variable internal variable
|
||||
@ -504,7 +543,6 @@ Expression syntax summary, from least to most significant:
|
||||
$VAR environment variable
|
||||
@r contents of register 'r'
|
||||
function(expr1, ...) function call
|
||||
Funcref(expr1, ...) function call with Funcref variable
|
||||
func{ti}on(expr1, ...) function call with curly braces
|
||||
|
||||
|
||||
@ -696,10 +734,10 @@ These three can be repeated and mixed. Examples:
|
||||
|
||||
expr8 *expr8*
|
||||
-----
|
||||
expr9[expr1] item of String or List *expr-[]* *E111*
|
||||
expr8[expr1] item of String or List *expr-[]* *E111*
|
||||
|
||||
If expr9 is a Number or String this results in a String that contains the
|
||||
expr1'th single byte from expr9. expr9 is used as a String, expr1 as a
|
||||
If expr8 is a Number or String this results in a String that contains the
|
||||
expr1'th single byte from expr8. expr8 is used as a String, expr1 as a
|
||||
Number. Note that this doesn't recognize multi-byte encodings.
|
||||
|
||||
Index zero gives the first character. This is like it works in C. Careful:
|
||||
@ -711,7 +749,7 @@ If the length of the String is less than the index, the result is an empty
|
||||
String. A negative index always results in an empty string (reason: backwards
|
||||
compatibility). Use [-1:] to get the last byte.
|
||||
|
||||
If expr9 is a List then it results the item at index expr1. See |list-index|
|
||||
If expr8 is a List then it results the item at index expr1. See |list-index|
|
||||
for possible index values. If the index is out of range this results in an
|
||||
error. Example: >
|
||||
:let item = mylist[-1] " get last item
|
||||
@ -720,10 +758,10 @@ Generally, if a List index is equal to or higher than the length of the List,
|
||||
or more negative than the length of the List, this results in an error.
|
||||
|
||||
|
||||
expr9[expr1a : expr1b] substring or sublist *expr-[:]*
|
||||
expr8[expr1a : expr1b] substring or sublist *expr-[:]*
|
||||
|
||||
If expr9 is a Number or String this results in the substring with the bytes
|
||||
from expr1a to and including expr1b. expr9 is used as a String, expr1a and
|
||||
If expr8 is a Number or String this results in the substring with the bytes
|
||||
from expr1a to and including expr1b. expr8 is used as a String, expr1a and
|
||||
expr1b are used as a Number. Note that this doesn't recognize multi-byte
|
||||
encodings.
|
||||
|
||||
@ -742,20 +780,20 @@ Examples: >
|
||||
:let s = line(".")[4:] " from the fifth byte to the end
|
||||
:let s = s[:-3] " remove last two bytes
|
||||
|
||||
If expr9 is a List this results in a new List with the items indicated by the
|
||||
If expr8 is a List this results in a new List with the items indicated by the
|
||||
indexes expr1a and expr1b. This works like with a String, as explained just
|
||||
above, except that indexes out of range cause an error. Examples: >
|
||||
:let l = mylist[:3] " first four items
|
||||
:let l = mylist[4:4] " List with one item
|
||||
:let l = mylist[:] " shallow copy of a List
|
||||
|
||||
Using expr9[expr1] or expr9[expr1a : expr1b] on a Funcref results in an error.
|
||||
Using expr8[expr1] or expr8[expr1a : expr1b] on a Funcref results in an error.
|
||||
|
||||
|
||||
expr9.name entry in a Dictionary *expr-entry*
|
||||
expr8.name entry in a Dictionary *expr-entry*
|
||||
|
||||
If expr9 is a Dictionary and it is followed by a dot, then the following name
|
||||
will be used as a key in the Dictionary. This is just like: expr9[name].
|
||||
If expr8 is a Dictionary and it is followed by a dot, then the following name
|
||||
will be used as a key in the Dictionary. This is just like: expr8[name].
|
||||
|
||||
The name must consist of alphanumeric characters, just like a variable name,
|
||||
but it may start with a number. Curly braces cannot be used.
|
||||
@ -771,6 +809,12 @@ Note that the dot is also used for String concatenation. To avoid confusion
|
||||
always put spaces around the dot for String concatenation.
|
||||
|
||||
|
||||
expr8(expr1, ...) Funcref function call
|
||||
|
||||
When expr8 is a |Funcref| type variable, invoke the function it refers to.
|
||||
|
||||
|
||||
|
||||
*expr9*
|
||||
number
|
||||
------
|
||||
@ -1147,6 +1191,11 @@ v:insertmode Used for the |InsertEnter| and |InsertChange| autocommand
|
||||
r Replace mode
|
||||
v Virtual Replace mode
|
||||
|
||||
*v:key* *key-variable*
|
||||
v:key Key of the current item of a Dictionary. Only valid while
|
||||
evaluating the expression used with |map()| and |filter()|.
|
||||
Read-only.
|
||||
|
||||
*v:lang* *lang-variable*
|
||||
v:lang The current locale setting for messages of the runtime
|
||||
environment. This allows Vim scripts to be aware of the
|
||||
@ -1239,6 +1288,11 @@ v:throwpoint The point where the exception most recently caught and not
|
||||
:endtry
|
||||
< Output: "Exception from test.vim, line 2"
|
||||
|
||||
*v:val* *val-variable*
|
||||
v:val Value of the current item of a List or Dictionary. Only valid
|
||||
while evaluating the expression used with |map()| and
|
||||
|filter()|. Read-only.
|
||||
|
||||
*v:version* *version-variable*
|
||||
v:version Version number of Vim: Major version number times 100 plus
|
||||
minor version number. Version 5.0 is 500. Version 5.1 (5.01)
|
||||
@ -1278,7 +1332,8 @@ bufnr( {expr}) Number Number of the buffer {expr}
|
||||
bufwinnr( {expr}) Number window number of buffer {expr}
|
||||
byte2line( {byte}) Number line number at byte count {byte}
|
||||
byteidx( {expr}, {nr}) Number byte index of {nr}'th char in {expr}
|
||||
call( {func}, {arglist}) any call {func} with arguments {arglist}
|
||||
call( {func}, {arglist} [, {dict}])
|
||||
any call {func} with arguments {arglist}
|
||||
char2nr( {expr}) Number ASCII value of first char in {expr}
|
||||
cindent( {lnum}) Number C indent for line {lnum}
|
||||
col( {expr}) Number column nr of cursor or mark
|
||||
@ -1303,7 +1358,8 @@ executable( {expr}) Number 1 if executable {expr} exists
|
||||
exists( {expr}) Number TRUE if {expr} exists
|
||||
expand( {expr}) String expand special keywords in {expr}
|
||||
filereadable( {file}) Number TRUE if {file} is a readable file
|
||||
filter( {list}, {expr}) List remove from {list} where {expr} is 0
|
||||
filter( {expr}, {string}) List/Dict remove items from {expr} where
|
||||
{string} is 0
|
||||
finddir( {name}[, {path}[, {count}]])
|
||||
String Find directory {name} in {path}
|
||||
findfile( {name}[, {path}[, {count}]])
|
||||
@ -1317,6 +1373,7 @@ foldtext( ) String line displayed for closed fold
|
||||
foreground( ) Number bring the Vim window to the foreground
|
||||
function( {name}) Funcref reference to function {name}
|
||||
get( {list}, {idx} [, {def}]) any get item {idx} from {list} or {def}
|
||||
get( {dict}, {key} [, {def}]) any get item {key} from {dict} or {def}
|
||||
getchar( [expr]) Number get one character from the user
|
||||
getcharmod( ) Number modifiers for the last typed character
|
||||
getbufvar( {expr}, {varname}) variable {varname} in buffer {expr}
|
||||
@ -1337,6 +1394,7 @@ getwinvar( {nr}, {varname}) variable {varname} in window {nr}
|
||||
glob( {expr}) String expand file wildcards in {expr}
|
||||
globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path}
|
||||
has( {feature}) Number TRUE if feature {feature} supported
|
||||
has_key( {dict}, {key}) Number TRUE if {dict} has entry {key}
|
||||
hasmapto( {what} [, {mode}]) Number TRUE if mapping to {what} exists
|
||||
histadd( {history},{item}) String add an item to a history
|
||||
histdel( {history} [, {item}]) String remove an item from a history
|
||||
@ -1365,7 +1423,7 @@ line( {expr}) Number line nr of cursor, last line or mark
|
||||
line2byte( {lnum}) Number byte count of line {lnum}
|
||||
lispindent( {lnum}) Number Lisp indent for line {lnum}
|
||||
localtime() Number current time
|
||||
map( {list}, {expr}) List change each item in {list} to {expr}
|
||||
map( {expr}, {string}) List/Dict change each item in {expr} to {expr}
|
||||
maparg( {name}[, {mode}]) String rhs of mapping {name} in mode {mode}
|
||||
mapcheck( {name}[, {mode}]) String check for mappings matching {name}
|
||||
match( {expr}, {pat}[, {start}[, {count}]])
|
||||
@ -1617,12 +1675,14 @@ byteidx({expr}, {nr}) *byteidx()*
|
||||
If there are exactly {nr} characters the length of the string
|
||||
is returned.
|
||||
|
||||
call({func}, {arglist}) *call()* *E699*
|
||||
call({func}, {arglist} [, {dict}]) *call()* *E699*
|
||||
Call function {func} with the items in List {arglist} as
|
||||
arguments.
|
||||
{func} can either be a Funcref or the name of a function.
|
||||
a:firstline and a:lastline are set to the cursor line.
|
||||
Returns the return value of the called function.
|
||||
{dict} is for functions with the "dict" attribute. It will be
|
||||
used to set the local variable "self". |Dictionary-function|
|
||||
|
||||
char2nr({expr}) *char2nr()*
|
||||
Return number value of the first char in {expr}. Examples: >
|
||||
@ -1722,10 +1782,11 @@ copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't
|
||||
changing an item changes the contents of both Lists. Also see
|
||||
|deepcopy()|.
|
||||
|
||||
count({list}, {expr} [, {start} [, {ic}]]) *count()*
|
||||
count({comp}, {expr} [, {ic} [, {start}]]) *count()*
|
||||
Return the number of times an item with value {expr} appears
|
||||
in List {list}.
|
||||
If {start} is given then don't count items with a lower index.
|
||||
in List or Dictionary {comp}.
|
||||
If {start} is given then start with the item with this index.
|
||||
{start} can only be used with a List.
|
||||
When {ic} is given and it's non-zero then case is ignored.
|
||||
|
||||
|
||||
@ -1831,7 +1892,7 @@ diff_hlID({lnum}, {col}) *diff_hlID()*
|
||||
|
||||
empty({expr}) *empty()*
|
||||
Return the Number 1 if {expr} is empty, zero otherwise.
|
||||
A List is empty when it does not have any items.
|
||||
A List or Dictionary is empty when it does not have any items.
|
||||
A Number is empty when its value is zero.
|
||||
For a long List this is much faster then comparing the length
|
||||
with zero.
|
||||
@ -1999,22 +2060,35 @@ expand({expr} [, {flag}]) *expand()*
|
||||
See |glob()| for finding existing files. See |system()| for
|
||||
getting the raw output of an external command.
|
||||
|
||||
extend({list1}, {list2} [, {idx}]) *extend()*
|
||||
Append {list2} to {list1}.
|
||||
If {idx} is given insert the items of {list2} before item
|
||||
{idx} in {list1}. When {idx} is zero insert before the first
|
||||
item. When {idx} is equal to len({list1}) then {list2} is
|
||||
appended.
|
||||
{list1} is changed when {list2} is not empty.
|
||||
{list2} remains unchanged.
|
||||
{list1} and {list2} must be Lists.
|
||||
Returns {list1}.
|
||||
extend({expr1}, {expr2} [, {expr3}]) *extend()*
|
||||
{expr1} and {expr2} must be both Lists or both Dictionaries.
|
||||
|
||||
If they are Lists: Append {expr2} to {expr1}.
|
||||
If {expr3} is given insert the items of {expr2} before item
|
||||
{expr3} in {expr1}. When {expr3} is zero insert before the
|
||||
first item. When {expr3} is equal to len({expr1}) then
|
||||
{expr2} is appended.
|
||||
Examples: >
|
||||
:echo sort(extend(mylist, [7, 5]))
|
||||
:call extend(mylist, [2, 3], 1)
|
||||
< Use |add()| to concatenate one item to a list. To concatenate
|
||||
two lists into a new list use the + operator: >
|
||||
:let newlist = [1, 2, 3] + [4, 5]
|
||||
<
|
||||
If they are Dictionaries:
|
||||
Add all entries from {expr2} to {expr1}.
|
||||
If a key exists in both {expr1} and {expr2} then {expr3} is
|
||||
used to decide what to do:
|
||||
{expr3} = "keep": keep the value of {expr1}
|
||||
{expr3} = "force": use the value of {expr2}
|
||||
{expr3} = "error": give an error message
|
||||
When {expr3} is omitted then "force" is assumed.
|
||||
|
||||
{expr1} is changed when {expr2} is not empty. If necessary
|
||||
make a copy of {expr1} first.
|
||||
{expr2} remains unchanged.
|
||||
Returns {expr1}.
|
||||
|
||||
|
||||
filereadable({file}) *filereadable()*
|
||||
The result is a Number, which is TRUE when a file with the
|
||||
@ -2025,23 +2099,29 @@ filereadable({file}) *filereadable()*
|
||||
Obsolete name: file_readable().
|
||||
|
||||
|
||||
filter({list}, {expr}) *filter()* *E712*
|
||||
For each item in {list} evaluate {expr} and when the result is
|
||||
zero remove the item from the List.
|
||||
Inside {expr} the symbol "&" stands for the existing
|
||||
item. Example: >
|
||||
:call filter(mylist, '& !~ "OLD"')
|
||||
< Removes the items where "OLD" appears. And this: >
|
||||
:call filter(mylist, 0)
|
||||
filter({expr}, {string}) *filter()*
|
||||
{expr} must be a List or a Dictionary.
|
||||
For each item in {expr} evaluate {string} and when the result
|
||||
is zero remove the item from the List or Dictionary.
|
||||
Inside {string} |v:val| has the value of the current item.
|
||||
For a Dictionary |v:key| has the key of the current item.
|
||||
Examples: >
|
||||
:call filter(mylist, 'v:val !~ "OLD"')
|
||||
< Removes the items where "OLD" appears. >
|
||||
:call filter(mydict, 'v:key >= 8')
|
||||
< Removes the items with a key below 8. >
|
||||
:call filter(var, 0)
|
||||
< Removes all the items, thus clears the List or Dictionary.
|
||||
|
||||
Note that {expr} is an expression that evaluates to an
|
||||
expression. Often it is good to use a |literal-string| to
|
||||
avoid having to double backslashes.
|
||||
The operation is done in-place. If you want a list to remain
|
||||
unmodified make a copy first: >
|
||||
Note that {string} is the result of expression and is then
|
||||
used as an expression again. Often it is good to use a
|
||||
|literal-string| to avoid having to double backslashes.
|
||||
|
||||
The operation is done in-place. If you want a List or
|
||||
Dictionary to remain unmodified make a copy first: >
|
||||
:let l = filter(copy(mylist), '& =~ "KEEP"')
|
||||
< Returns {list}.
|
||||
|
||||
< Returns {expr}, the List or Dictionary that was filtered.
|
||||
|
||||
|
||||
finddir({name}[, {path}[, {count}]]) *finddir()*
|
||||
@ -2141,6 +2221,11 @@ get({list}, {idx} [, {default}]) *get*
|
||||
Get item {idx} from List {list}. When this item is not
|
||||
available return {default}. Return zero when {default} is
|
||||
omitted.
|
||||
get({dict}, {key} [, {default}])
|
||||
Get item with key {key} from Dictionary {dict}. When this
|
||||
item is not available return {default}. Return zero when
|
||||
{default} is omitted.
|
||||
|
||||
|
||||
getbufvar({expr}, {varname}) *getbufvar()*
|
||||
The result is the value of option or local buffer variable
|
||||
@ -2388,6 +2473,12 @@ has({feature}) The result is a Number, which is 1 if the feature {feature} is
|
||||
string. See |feature-list| below.
|
||||
Also see |exists()|.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
hasmapto({what} [, {mode}]) *hasmapto()*
|
||||
The result is a Number, which is 1 if there is a mapping that
|
||||
contains {what} in somewhere in the rhs (what it is mapped to)
|
||||
@ -2662,6 +2753,8 @@ len({expr}) The result is a Number, which is the length of the argument.
|
||||
used, as with |strlen()|.
|
||||
When {expr} is a List the number of items in the List is
|
||||
returned.
|
||||
When {expr} is a Dictionary the number of entries in the
|
||||
Dictionary is returned.
|
||||
Otherwise an error is given.
|
||||
|
||||
*libcall()* *E364* *E368*
|
||||
@ -2764,20 +2857,25 @@ localtime() *localtime()*
|
||||
1970. See also |strftime()| and |getftime()|.
|
||||
|
||||
|
||||
map({list}, {expr}) *map()*
|
||||
Replace each item in {list} with the result of evaluating
|
||||
{expr}.
|
||||
Inside {expr} the symbol "&" stands for the existing
|
||||
item. Example: >
|
||||
:call map(mylist, '"> " . & . " <"')
|
||||
map({expr}, {string}) *map()*
|
||||
{expr} must be a List or a Dictionary.
|
||||
Replace each item in {expr} with the result of evaluating
|
||||
{string}.
|
||||
Inside {string} |v:val| has the value of the current item.
|
||||
For a Dictionary |v:key| has the key of the current item.
|
||||
Example: >
|
||||
:call map(mylist, '"> " . v:val . " <"')
|
||||
< This puts "> " before and " <" after each item in "mylist".
|
||||
Note that {expr} is an expression that evaluates to an
|
||||
expression. Often it is good to use a |literal-string| to
|
||||
avoid having to double backslashes.
|
||||
The operation is done in-place. If you want a list to remain
|
||||
unmodified make a copy first: >
|
||||
|
||||
Note that {string} is the result of expression and is then
|
||||
used as an expression again. Often it is good to use a
|
||||
|literal-string| to avoid having to double backslashes.
|
||||
|
||||
The operation is done in-place. If you want a List or
|
||||
Dictionary to remain unmodified make a copy first: >
|
||||
:let tlist = map(copy(mylist), ' & . "\t"')
|
||||
< Returns {list}.
|
||||
|
||||
< Returns {expr}, the List or Dictionary that was filtered.
|
||||
|
||||
|
||||
maparg({name}[, {mode}]) *maparg()*
|
||||
@ -3911,7 +4009,7 @@ instead of "s:" when the mapping is expanded outside of the script.
|
||||
|
||||
:fu[nction] {name} List function {name}.
|
||||
*E124* *E125*
|
||||
:fu[nction][!] {name}([arguments]) [range] [abort]
|
||||
:fu[nction][!] {name}([arguments]) [range] [abort] [dict]
|
||||
Define a new function by the name {name}. The name
|
||||
must be made of alphanumeric characters and '_', and
|
||||
must start with a capital or "s:" (see above).
|
||||
@ -3950,6 +4048,10 @@ instead of "s:" when the mapping is expanded outside of the script.
|
||||
abort as soon as an error is detected.
|
||||
The last used search pattern and the redo command "."
|
||||
will not be changed by the function.
|
||||
When the [dict] argument is added, the function must
|
||||
be invoked through an entry in a Dictionary. The
|
||||
local variable "self" will then be set to the
|
||||
dictionary. See |Dictionary-function|.
|
||||
|
||||
*:endf* *:endfunction* *E126* *E193*
|
||||
:endf[unction] The end of a function definition. Must be on a line
|
||||
|
@ -2936,6 +2936,7 @@ DOS os_dos.txt /*DOS*
|
||||
DOS-format editing.txt /*DOS-format*
|
||||
DOS-format-write editing.txt /*DOS-format-write*
|
||||
DPMI os_msdos.txt /*DPMI*
|
||||
Dictionaries eval.txt /*Dictionaries*
|
||||
Digraphs digraph.txt /*Digraphs*
|
||||
E motion.txt /*E*
|
||||
E10 message.txt /*E10*
|
||||
@ -4478,6 +4479,7 @@ diW motion.txt /*diW*
|
||||
dialog gui_w32.txt /*dialog*
|
||||
dialogs-added version5.txt /*dialogs-added*
|
||||
dib motion.txt /*dib*
|
||||
dict-modification eval.txt /*dict-modification*
|
||||
did_filetype() eval.txt /*did_filetype()*
|
||||
diff diff.txt /*diff*
|
||||
diff-diffexpr diff.txt /*diff-diffexpr*
|
||||
@ -4629,7 +4631,6 @@ expr-!=? eval.txt /*expr-!=?*
|
||||
expr-!~ eval.txt /*expr-!~*
|
||||
expr-!~# eval.txt /*expr-!~#*
|
||||
expr-!~? eval.txt /*expr-!~?*
|
||||
expr-# eval.txt /*expr-#*
|
||||
expr-% eval.txt /*expr-%*
|
||||
expr-&& eval.txt /*expr-&&*
|
||||
expr-' eval.txt /*expr-'*
|
||||
@ -4658,6 +4659,7 @@ expr->? eval.txt /*expr->?*
|
||||
expr-[:] eval.txt /*expr-[:]*
|
||||
expr-[] eval.txt /*expr-[]*
|
||||
expr-barbar eval.txt /*expr-barbar*
|
||||
expr-entry eval.txt /*expr-entry*
|
||||
expr-env eval.txt /*expr-env*
|
||||
expr-env-expand eval.txt /*expr-env-expand*
|
||||
expr-function eval.txt /*expr-function*
|
||||
@ -4999,6 +5001,7 @@ hangul hangulin.txt /*hangul*
|
||||
hangulin.txt hangulin.txt /*hangulin.txt*
|
||||
has() eval.txt /*has()*
|
||||
has-patch eval.txt /*has-patch*
|
||||
has_key() eval.txt /*has_key()*
|
||||
haskell-syntax syntax.txt /*haskell-syntax*
|
||||
haskell.vim syntax.txt /*haskell.vim*
|
||||
hasmapto() eval.txt /*hasmapto()*
|
||||
@ -5006,6 +5009,7 @@ hebrew hebrew.txt /*hebrew*
|
||||
hebrew.txt hebrew.txt /*hebrew.txt*
|
||||
help various.txt /*help*
|
||||
help-context help.txt /*help-context*
|
||||
help-tags tags 1
|
||||
help-translated various.txt /*help-translated*
|
||||
help-xterm-window various.txt /*help-xterm-window*
|
||||
help.txt help.txt /*help.txt*
|
||||
@ -5297,6 +5301,7 @@ key-codes intro.txt /*key-codes*
|
||||
key-codes-changed version4.txt /*key-codes-changed*
|
||||
key-mapping map.txt /*key-mapping*
|
||||
key-notation intro.txt /*key-notation*
|
||||
key-variable eval.txt /*key-variable*
|
||||
keycodes intro.txt /*keycodes*
|
||||
keymap-file-format mbyte.txt /*keymap-file-format*
|
||||
keymap-hebrew mbyte.txt /*keymap-hebrew*
|
||||
@ -5313,6 +5318,7 @@ keypad-page-down intro.txt /*keypad-page-down*
|
||||
keypad-page-up intro.txt /*keypad-page-up*
|
||||
keypad-plus intro.txt /*keypad-plus*
|
||||
keypad-point intro.txt /*keypad-point*
|
||||
keys() eval.txt /*keys()*
|
||||
known-bugs todo.txt /*known-bugs*
|
||||
l motion.txt /*l*
|
||||
l:var eval.txt /*l:var*
|
||||
@ -5344,6 +5350,7 @@ linewise motion.txt /*linewise*
|
||||
linewise-register change.txt /*linewise-register*
|
||||
linewise-visual visual.txt /*linewise-visual*
|
||||
lispindent() eval.txt /*lispindent()*
|
||||
list-identity eval.txt /*list-identity*
|
||||
list-index eval.txt /*list-index*
|
||||
list-modification eval.txt /*list-modification*
|
||||
list-repeat windows.txt /*list-repeat*
|
||||
@ -5895,6 +5902,7 @@ quotes.txt quotes.txt /*quotes.txt*
|
||||
quotestar gui.txt /*quotestar*
|
||||
quote~ change.txt /*quote~*
|
||||
r change.txt /*r*
|
||||
range() eval.txt /*range()*
|
||||
raw-terminal-mode term.txt /*raw-terminal-mode*
|
||||
rcp pi_netrw.txt /*rcp*
|
||||
read-messages insert.txt /*read-messages*
|
||||
@ -6059,7 +6067,6 @@ sgml-syntax syntax.txt /*sgml-syntax*
|
||||
sgml.vim syntax.txt /*sgml.vim*
|
||||
sh-syntax syntax.txt /*sh-syntax*
|
||||
sh.vim syntax.txt /*sh.vim*
|
||||
sharp-string eval.txt /*sharp-string*
|
||||
shell-window tips.txt /*shell-window*
|
||||
shell_error-variable eval.txt /*shell_error-variable*
|
||||
shift intro.txt /*shift*
|
||||
@ -6529,6 +6536,7 @@ v:foldend eval.txt /*v:foldend*
|
||||
v:foldlevel eval.txt /*v:foldlevel*
|
||||
v:foldstart eval.txt /*v:foldstart*
|
||||
v:insertmode eval.txt /*v:insertmode*
|
||||
v:key eval.txt /*v:key*
|
||||
v:lang eval.txt /*v:lang*
|
||||
v:lc_time eval.txt /*v:lc_time*
|
||||
v:lnum eval.txt /*v:lnum*
|
||||
@ -6541,6 +6549,7 @@ v:statusmsg eval.txt /*v:statusmsg*
|
||||
v:termresponse eval.txt /*v:termresponse*
|
||||
v:this_session eval.txt /*v:this_session*
|
||||
v:throwpoint eval.txt /*v:throwpoint*
|
||||
v:val eval.txt /*v:val*
|
||||
v:var eval.txt /*v:var*
|
||||
v:version eval.txt /*v:version*
|
||||
v:warningmsg eval.txt /*v:warningmsg*
|
||||
@ -6644,6 +6653,7 @@ v_v visual.txt /*v_v*
|
||||
v_x change.txt /*v_x*
|
||||
v_y change.txt /*v_y*
|
||||
v_~ change.txt /*v_~*
|
||||
val-variable eval.txt /*val-variable*
|
||||
variables eval.txt /*variables*
|
||||
various various.txt /*various*
|
||||
various-cmds various.txt /*various-cmds*
|
||||
|
@ -1,6 +1,6 @@
|
||||
" Vim script language tests
|
||||
" Author: Servatius Brandt <Servatius.Brandt@fujitsu-siemens.com>
|
||||
" Last Change: 2005 Jan 11
|
||||
" Last Change: 2005 Jan 15
|
||||
|
||||
"-------------------------------------------------------------------------------
|
||||
" Test environment {{{1
|
||||
@ -8433,7 +8433,7 @@ if ExtraVim()
|
||||
call T(23, '(1 ? 2) + CONT(23)', 'E109', "Missing ':' after '?'")
|
||||
call T(24, '("abc) + CONT(24)', 'E114', "Missing quote")
|
||||
call T(25, "('abc) + CONT(25)", 'E115', "Missing quote")
|
||||
call T(26, '& + CONT(26)', 'E712', "Using & outside of map()")
|
||||
call T(26, '& + CONT(26)', 'E112', "Option name missing")
|
||||
call T(27, '&asdf + CONT(27)', 'E113', "Unknown option")
|
||||
|
||||
Xpath 134217728 " X: 134217728
|
||||
|
@ -36,5 +36,5 @@
|
||||
#define VIM_VERSION_NODOT "vim70aa"
|
||||
#define VIM_VERSION_SHORT "7.0aa"
|
||||
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
|
||||
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 14)"
|
||||
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 14, compiled "
|
||||
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 15)"
|
||||
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 15, compiled "
|
||||
|
Loading…
x
Reference in New Issue
Block a user