executing commands, thus calling it recursively, then
all typeahead will be consumed by the last call.
'!' When used with 'x' will not end Insert mode. Can be
used in a test when a timer is set to exit Insert mode
a little later. Useful for testing CursorHoldI.
Return value is always 0.
Parameters: ~
• {string} (`string`)
• {mode} (`string?`)
Return: ~
(`any`)
filecopy({from}, {to}) *filecopy()*
Copy the file pointed to by the name {from} to {to}. The
result is a Number, which is |TRUE| if the file was copied
successfully, and |FALSE| when it failed.
If a file with name {to} already exists, it will fail.
Note that it does not handle directories (yet).
This function is not available in the |sandbox|.
Parameters: ~
• {from} (`string`)
• {to} (`string`)
Return: ~
(`0|1`)
filereadable({file}) *filereadable()*
The result is a Number, which is |TRUE| when a file with the
name {file} exists, and can be read. If {file} doesn't exist,
or is a directory, the result is |FALSE|. {file} is any
expression, which is used as a String.
If you don't care about the file being readable you can use
|glob()|.
{file} is used as-is, you may want to expand wildcards first: >vim
echo filereadable('~/.vimrc')
< >
0
< >vim
echo filereadable(expand('~/.vimrc'))
< >
1
<
Parameters: ~
• {file} (`string`)
Return: ~
(`0|1`)
filewritable({file}) *filewritable()*
The result is a Number, which is 1 when a file with the
name {file} exists, and can be written. If {file} doesn't
exist, or is not writable, the result is 0. If {file} is a
directory, and we can write to it, the result is 2.
Parameters: ~
• {file} (`string`)
Return: ~
(`0|1`)
filter({expr1}, {expr2}) *filter()*
{expr1} must be a |List|, |String|, |Blob| or |Dictionary|.
For each item in {expr1} evaluate {expr2} and when the result
is zero or false remove the item from the |List| or
|Dictionary|. Similarly for each byte in a |Blob| and each
character in a |String|.
{expr2} must be a |string| or |Funcref|.
If {expr2} is a |string|, inside {expr2} |v:val| has the value
of the current item. For a |Dictionary| |v:key| has the key
of the current item and for a |List| |v:key| has the index of
the current item. For a |Blob| |v:key| has the index of the
current byte. For a |String| |v:key| has the index of the
current character.
Examples: >vim
call filter(mylist, 'v:val !~ "OLD"')
< Removes the items where "OLD" appears. >vim
call filter(mydict, 'v:key >= 8')
< Removes the items with a key below 8. >vim
call filter(var, 0)
< Removes all the items, thus clears the |List| or |Dictionary|.
Note that {expr2} 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.
If {expr2} is a |Funcref| it must take two arguments:
1. the key or the index of the current item.
2. the value of the current item.
The function must return |TRUE| if the item should be kept.
Example that keeps the odd items of a list: >vim
func Odd(idx, val)
return a:idx % 2 == 1
endfunc
call filter(mylist, function('Odd'))
< It is shorter when using a |lambda|: >vim
call filter(myList, {idx, val -> idx * val <= 42})
< If you do not use "val" you can leave it out: >vim
call filter(myList, {idx -> idx % 2 == 1})
<
For a |List| and a |Dictionary| the operation is done
in-place. If you want it to remain unmodified make