summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-10-25 12:32:11 +0200
committerBram Moolenaar <Bram@vim.org>2018-10-25 12:32:11 +0200
commite6e3989c1b3f18907a0c305712b867e9a3821369 (patch)
tree4809dda0c07ac5d06047b9c474d6507cf1fa68b0 /runtime
parentbf9679ae4684cb0c4e6ef2c24da0f83955d53e57 (diff)
patch 8.1.0493: argv() and argc() only work on the current argument listv8.1.0493
Problem: argv() and argc() only work on the current argument list. Solution: Add a window ID argument. (Yegappan Lakshmanan, closes #832)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt31
1 files changed, 20 insertions, 11 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index d51da60f84..2e58c854e7 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2026,11 +2026,11 @@ append({lnum}, {text}) Number append {text} below line {lnum}
appendbufline({expr}, {lnum}, {text})
Number append {text} below line {lnum}
in buffer {expr}
-argc() Number number of files in the argument list
+argc( [{winid}]) Number number of files in the argument list
argidx() Number current index in the argument list
arglistid([{winnr} [, {tabnr}]]) Number argument list id
-argv({nr}) String {nr} entry of the argument list
-argv() List the argument list
+argv({nr} [, {winid}]) String {nr} entry of the argument list
+argv([-1, {winid}]) List the argument list
assert_beeps({cmd}) Number assert {cmd} causes a beep
assert_equal({exp}, {act} [, {msg}])
Number assert {exp} is equal to {act}
@@ -2596,8 +2596,15 @@ appendbufline({expr}, {lnum}, {text}) *appendbufline()*
:let failed = appendbufline(13, 0, "# THE START")
<
*argc()*
-argc() The result is the number of files in the argument list of the
- current window. See |arglist|.
+argc([{winid}])
+ The result is the number of files in the argument list. See
+ |arglist|.
+ If {winid} is not supplied, the argument list of the current
+ window is used.
+ If {winid} is -1, the global argument list is used.
+ Otherwise {winid} specifies the window of which the argument
+ list is used: either the window number or the window ID.
+ Returns -1 if the {winid} argument is invalid.
*argidx()*
argidx() The result is the current index in the argument list. 0 is
@@ -2608,7 +2615,7 @@ arglistid([{winnr} [, {tabnr}]])
Return the argument list ID. This is a number which
identifies the argument list being used. Zero is used for the
global argument list. See |arglist|.
- Return -1 if the arguments are invalid.
+ Returns -1 if the arguments are invalid.
Without arguments use the current window.
With {winnr} only use this window in the current tab page.
@@ -2617,17 +2624,19 @@ arglistid([{winnr} [, {tabnr}]])
{winnr} can be the window number or the |window-ID|.
*argv()*
-argv([{nr}]) The result is the {nr}th file in the argument list of the
- current window. See |arglist|. "argv(0)" is the first one.
- Example: >
+argv([{nr} [, {winid}])
+ The result is the {nr}th file in the argument list. See
+ |arglist|. "argv(0)" is the first one. Example: >
:let i = 0
:while i < argc()
: let f = escape(fnameescape(argv(i)), '.')
: exe 'amenu Arg.' . f . ' :e ' . f . '<CR>'
: let i = i + 1
:endwhile
-< Without the {nr} argument a |List| with the whole |arglist| is
- returned.
+< Without the {nr} argument, or when {nr} is -1, a |List| with
+ the whole |arglist| is returned.
+
+ The {winid} argument specifies the window ID, see |argc()|.
assert_beeps({cmd}) *assert_beeps()*
Run {cmd} and add an error message to |v:errors| if it does