Mercurial > vim
comparison runtime/doc/eval.txt @ 14964:2c0bfa167468 v8.1.0493
patch 8.1.0493: argv() and argc() only work on the current argument list
commit https://github.com/vim/vim/commit/e6e3989c1b3f18907a0c305712b867e9a3821369
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 25 12:32:11 2018 +0200
patch 8.1.0493: argv() and argc() only work on the current argument list
Problem: argv() and argc() only work on the current argument list.
Solution: Add a window ID argument. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/832)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 25 Oct 2018 12:45:05 +0200 |
parents | 4ee65b4150fd |
children | 2b30a2b4bde2 |
comparison
equal
deleted
inserted
replaced
14963:81993fcbec84 | 14964:2c0bfa167468 |
---|---|
2024 and({expr}, {expr}) Number bitwise AND | 2024 and({expr}, {expr}) Number bitwise AND |
2025 append({lnum}, {text}) Number append {text} below line {lnum} | 2025 append({lnum}, {text}) Number append {text} below line {lnum} |
2026 appendbufline({expr}, {lnum}, {text}) | 2026 appendbufline({expr}, {lnum}, {text}) |
2027 Number append {text} below line {lnum} | 2027 Number append {text} below line {lnum} |
2028 in buffer {expr} | 2028 in buffer {expr} |
2029 argc() Number number of files in the argument list | 2029 argc( [{winid}]) Number number of files in the argument list |
2030 argidx() Number current index in the argument list | 2030 argidx() Number current index in the argument list |
2031 arglistid([{winnr} [, {tabnr}]]) Number argument list id | 2031 arglistid([{winnr} [, {tabnr}]]) Number argument list id |
2032 argv({nr}) String {nr} entry of the argument list | 2032 argv({nr} [, {winid}]) String {nr} entry of the argument list |
2033 argv() List the argument list | 2033 argv([-1, {winid}]) List the argument list |
2034 assert_beeps({cmd}) Number assert {cmd} causes a beep | 2034 assert_beeps({cmd}) Number assert {cmd} causes a beep |
2035 assert_equal({exp}, {act} [, {msg}]) | 2035 assert_equal({exp}, {act} [, {msg}]) |
2036 Number assert {exp} is equal to {act} | 2036 Number assert {exp} is equal to {act} |
2037 assert_equalfile({fname-one}, {fname-two}) | 2037 assert_equalfile({fname-one}, {fname-two}) |
2038 Number assert file contents is equal | 2038 Number assert file contents is equal |
2594 If {expr} is not a valid buffer or {lnum} is not valid, an | 2594 If {expr} is not a valid buffer or {lnum} is not valid, an |
2595 error message is given. Example: > | 2595 error message is given. Example: > |
2596 :let failed = appendbufline(13, 0, "# THE START") | 2596 :let failed = appendbufline(13, 0, "# THE START") |
2597 < | 2597 < |
2598 *argc()* | 2598 *argc()* |
2599 argc() The result is the number of files in the argument list of the | 2599 argc([{winid}]) |
2600 current window. See |arglist|. | 2600 The result is the number of files in the argument list. See |
2601 |arglist|. | |
2602 If {winid} is not supplied, the argument list of the current | |
2603 window is used. | |
2604 If {winid} is -1, the global argument list is used. | |
2605 Otherwise {winid} specifies the window of which the argument | |
2606 list is used: either the window number or the window ID. | |
2607 Returns -1 if the {winid} argument is invalid. | |
2601 | 2608 |
2602 *argidx()* | 2609 *argidx()* |
2603 argidx() The result is the current index in the argument list. 0 is | 2610 argidx() The result is the current index in the argument list. 0 is |
2604 the first file. argc() - 1 is the last one. See |arglist|. | 2611 the first file. argc() - 1 is the last one. See |arglist|. |
2605 | 2612 |
2606 *arglistid()* | 2613 *arglistid()* |
2607 arglistid([{winnr} [, {tabnr}]]) | 2614 arglistid([{winnr} [, {tabnr}]]) |
2608 Return the argument list ID. This is a number which | 2615 Return the argument list ID. This is a number which |
2609 identifies the argument list being used. Zero is used for the | 2616 identifies the argument list being used. Zero is used for the |
2610 global argument list. See |arglist|. | 2617 global argument list. See |arglist|. |
2611 Return -1 if the arguments are invalid. | 2618 Returns -1 if the arguments are invalid. |
2612 | 2619 |
2613 Without arguments use the current window. | 2620 Without arguments use the current window. |
2614 With {winnr} only use this window in the current tab page. | 2621 With {winnr} only use this window in the current tab page. |
2615 With {winnr} and {tabnr} use the window in the specified tab | 2622 With {winnr} and {tabnr} use the window in the specified tab |
2616 page. | 2623 page. |
2617 {winnr} can be the window number or the |window-ID|. | 2624 {winnr} can be the window number or the |window-ID|. |
2618 | 2625 |
2619 *argv()* | 2626 *argv()* |
2620 argv([{nr}]) The result is the {nr}th file in the argument list of the | 2627 argv([{nr} [, {winid}]) |
2621 current window. See |arglist|. "argv(0)" is the first one. | 2628 The result is the {nr}th file in the argument list. See |
2622 Example: > | 2629 |arglist|. "argv(0)" is the first one. Example: > |
2623 :let i = 0 | 2630 :let i = 0 |
2624 :while i < argc() | 2631 :while i < argc() |
2625 : let f = escape(fnameescape(argv(i)), '.') | 2632 : let f = escape(fnameescape(argv(i)), '.') |
2626 : exe 'amenu Arg.' . f . ' :e ' . f . '<CR>' | 2633 : exe 'amenu Arg.' . f . ' :e ' . f . '<CR>' |
2627 : let i = i + 1 | 2634 : let i = i + 1 |
2628 :endwhile | 2635 :endwhile |
2629 < Without the {nr} argument a |List| with the whole |arglist| is | 2636 < Without the {nr} argument, or when {nr} is -1, a |List| with |
2630 returned. | 2637 the whole |arglist| is returned. |
2638 | |
2639 The {winid} argument specifies the window ID, see |argc()|. | |
2631 | 2640 |
2632 assert_beeps({cmd}) *assert_beeps()* | 2641 assert_beeps({cmd}) *assert_beeps()* |
2633 Run {cmd} and add an error message to |v:errors| if it does | 2642 Run {cmd} and add an error message to |v:errors| if it does |
2634 NOT produce a beep or visual bell. | 2643 NOT produce a beep or visual bell. |
2635 Also see |assert_fails()| and |assert-return|. | 2644 Also see |assert_fails()| and |assert-return|. |