mirror of
https://github.com/vim/vim.git
synced 2025-10-01 04:54:07 -04:00
patch 8.0.0721: :argedit can only have one argument
Problem: :argedit can only have one argument. Solution: Allow for multiple arguments. (Christian Brabandt)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
*editing.txt* For Vim version 8.0. Last change: 2017 Jun 20
|
*editing.txt* For Vim version 8.0. Last change: 2017 Jul 16
|
||||||
|
|
||||||
|
|
||||||
VIM REFERENCE MANUAL by Bram Moolenaar
|
VIM REFERENCE MANUAL by Bram Moolenaar
|
||||||
@@ -617,16 +617,16 @@ list of the current window.
|
|||||||
Also see |++opt| and |+cmd|.
|
Also see |++opt| and |+cmd|.
|
||||||
{Vi: no ++opt}
|
{Vi: no ++opt}
|
||||||
|
|
||||||
:[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|.
|
||||||
{not in Vi}
|
{not in Vi}
|
||||||
|
|
||||||
|
@@ -137,7 +137,7 @@ EX(CMD_argdo, "argdo", ex_listdo,
|
|||||||
BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
|
BANG|NEEDARG|EXTRA|NOTRLCOM|RANGE|NOTADR|DFLALL,
|
||||||
ADDR_ARGUMENTS),
|
ADDR_ARGUMENTS),
|
||||||
EX(CMD_argedit, "argedit", ex_argedit,
|
EX(CMD_argedit, "argedit", ex_argedit,
|
||||||
BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILE1|EDITCMD|ARGOPT|TRLBAR,
|
BANG|NEEDARG|RANGE|NOTADR|ZEROR|FILES|EDITCMD|ARGOPT|TRLBAR,
|
||||||
ADDR_ARGUMENTS),
|
ADDR_ARGUMENTS),
|
||||||
EX(CMD_argglobal, "argglobal", ex_args,
|
EX(CMD_argglobal, "argglobal", ex_args,
|
||||||
BANG|FILES|EDITCMD|ARGOPT|TRLBAR,
|
BANG|FILES|EDITCMD|ARGOPT|TRLBAR,
|
||||||
|
@@ -2801,34 +2801,20 @@ ex_next(exarg_T *eap)
|
|||||||
void
|
void
|
||||||
ex_argedit(exarg_T *eap)
|
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;
|
||||||
|
#ifdef FEAT_TITLE
|
||||||
/* Check if this argument is already in the argument list. */
|
maketitle();
|
||||||
for (i = 0; i < ARGCOUNT; ++i)
|
#endif
|
||||||
if (ARGLIST[i].ae_fnum == fnum)
|
|
||||||
break;
|
|
||||||
if (i == ARGCOUNT)
|
|
||||||
{
|
|
||||||
/* Can't find it, add it to the argument list. */
|
|
||||||
s = vim_strsave(eap->arg);
|
|
||||||
if (s == NULL)
|
|
||||||
return;
|
|
||||||
i = alist_add_list(1, &s,
|
|
||||||
eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1);
|
|
||||||
if (i < 0)
|
|
||||||
return;
|
|
||||||
curwin->w_arg_idx = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
alist_check_arg_idx();
|
|
||||||
|
|
||||||
|
if (curwin->w_arg_idx == 0 && (curbuf->b_ml.ml_flags & ML_EMPTY)
|
||||||
|
&& curbuf->b_ffname == NULL)
|
||||||
|
i = 0;
|
||||||
/* Edit the argument. */
|
/* Edit the argument. */
|
||||||
do_argfile(eap, i);
|
if (i < ARGCOUNT)
|
||||||
|
do_argfile(eap, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -188,6 +188,11 @@ func Test_zero_argadd()
|
|||||||
2argu
|
2argu
|
||||||
arga third
|
arga third
|
||||||
call assert_equal(['edited', 'a', 'third', 'b', 'c', 'd'], argv())
|
call assert_equal(['edited', 'a', 'third', 'b', 'c', 'd'], argv())
|
||||||
|
|
||||||
|
2argu
|
||||||
|
argedit file\ with\ spaces another file
|
||||||
|
call assert_equal(['edited', 'a', 'file with spaces', 'another', 'file', 'third', 'b', 'c', 'd'], argv())
|
||||||
|
call assert_equal('file with spaces', expand('%'))
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func Reset_arglist()
|
func Reset_arglist()
|
||||||
@@ -239,20 +244,19 @@ func Test_argedit()
|
|||||||
call assert_equal(['a', 'b'], argv())
|
call assert_equal(['a', 'b'], argv())
|
||||||
call assert_equal('b', expand('%:t'))
|
call assert_equal('b', expand('%:t'))
|
||||||
argedit a
|
argedit a
|
||||||
call assert_equal(['a', 'b'], argv())
|
call assert_equal(['a', 'b', 'a'], argv())
|
||||||
call assert_equal('a', expand('%:t'))
|
call assert_equal('a', expand('%:t'))
|
||||||
if has('unix')
|
argedit C D
|
||||||
" on MS-Windows this would edit file "a b"
|
call assert_equal('C', expand('%:t'))
|
||||||
call assert_fails('argedit a b', 'E172:')
|
call assert_equal(['a', 'b', 'a', 'C', 'D'], argv())
|
||||||
endif
|
|
||||||
argedit c
|
argedit c
|
||||||
call assert_equal(['a', 'c', 'b'], argv())
|
call assert_equal(['a', 'b', 'a', 'C', 'c', 'D'], argv())
|
||||||
0argedit x
|
0argedit x
|
||||||
call assert_equal(['x', 'a', 'c', 'b'], argv())
|
call assert_equal(['x', 'a', 'b', 'a', 'C', 'c', 'D'], argv())
|
||||||
enew! | set modified
|
enew! | set modified
|
||||||
call assert_fails('argedit y', 'E37:')
|
call assert_fails('argedit y', 'E37:')
|
||||||
argedit! y
|
argedit! y
|
||||||
call assert_equal(['x', 'y', 'a', 'c', 'b'], argv())
|
call assert_equal(['x', 'y', 'y', 'a', 'b', 'a', 'C', 'c', 'D'], argv())
|
||||||
%argd
|
%argd
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
@@ -769,6 +769,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
721,
|
||||||
/**/
|
/**/
|
||||||
720,
|
720,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user