vim-patch:8.0.0721: :argedit can only have one argument

Problem:    :argedit can only have one argument.
Solution:   Allow for multiple arguments. (Christian Brabandt)
90305c66a8
This commit is contained in:
Justin M. Keyes 2018-02-02 22:27:43 +01:00
parent 6df80e8762
commit bbdb074aec
3 changed files with 18 additions and 28 deletions

View File

@ -562,16 +562,16 @@ list of the current window.
buffer. buffer.
Also see |++opt| and |+cmd|. Also see |++opt| and |+cmd|.
:[count]arge[dit][!] [++opt] [+cmd] {name} *:arge* *:argedit* :[count]arge[dit][!] [++opt] [+cmd] {name} .. *:arge* *:argedit*
Add {name} to the argument list and edit it. Add {name}s to the argument list and edit it.
When {name} already exists in the argument list, this When {name} already exists in the argument list, this
entry is edited. entry is edited.
This is like using |:argadd| and then |:edit|. This is like using |:argadd| and then |:edit|.
Note that only one file name is allowed, and spaces Spaces in filenames have to be escaped with "\".
inside the file name are allowed, like with |:edit|.
[count] is used like with |:argadd|. [count] is used like with |:argadd|.
[!] is required if the current file cannot be If the current file cannot be |abandon|ed {name}s will
|abandon|ed. still be added to the argument list, but won't be
edited. No check for duplicates is done.
Also see |++opt| and |+cmd|. Also see |++opt| and |+cmd|.
:[count]arga[dd] {name} .. *:arga* *:argadd* *E479* :[count]arga[dd] {name} .. *:arga* *:argadd* *E479*

View File

@ -108,7 +108,7 @@ return {
}, },
{ {
command='argedit', command='argedit',
flags=bit.bor(BANG, NEEDARG, RANGE, NOTADR, ZEROR, FILE1, EDITCMD, ARGOPT, TRLBAR), flags=bit.bor(BANG, NEEDARG, RANGE, NOTADR, ZEROR, FILES, EDITCMD, ARGOPT, TRLBAR),
addr_type=ADDR_ARGUMENTS, addr_type=ADDR_ARGUMENTS,
func='ex_argedit', func='ex_argedit',
}, },

View File

@ -1915,31 +1915,21 @@ void ex_next(exarg_T *eap)
/// ":argedit" /// ":argedit"
void ex_argedit(exarg_T *eap) void ex_argedit(exarg_T *eap)
{ {
int fnum; int i = eap->addr_count ? (int)eap->line2 : curwin->w_arg_idx + 1;
int i;
char_u *s;
// Add the argument to the buffer list and get the buffer number. if (do_arglist(eap->arg, AL_ADD, i) == FAIL) {
fnum = buflist_add(eap->arg, BLN_LISTED); return;
// Check if this argument is already in the argument list.
for (i = 0; i < ARGCOUNT; i++) {
if (ARGLIST[i].ae_fnum == fnum) {
break;
}
} }
if (i == ARGCOUNT) { maketitle();
// Can't find it, add it to the argument list.
s = vim_strsave(eap->arg); if (curwin->w_arg_idx == 0 && (curbuf->b_ml.ml_flags & ML_EMPTY)
int after = eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1; && curbuf->b_ffname == NULL) {
i = alist_add_list(1, &s, after); i = 0;
curwin->w_arg_idx = i;
} }
alist_check_arg_idx();
// Edit the argument. // Edit the argument.
do_argfile(eap, i); if (i < ARGCOUNT) {
do_argfile(eap, i);
}
} }
/// ":argadd" /// ":argadd"