E163 confusing in some circumstances

1,734 views
Skip to first unread message

Ben Schmidt

unread,
Oct 23, 2012, 8:25:58 PM10/23/12
to vim-dev
I think E163 could do with some rewording, or perhaps another error
could be created. It seems E163 is used when there are less than two
arguments, and E165 or E164 when there are two or more. However, the
case when there are zero arguments is confusing. E.g.

vim -u NONE
:n
E163: There is only one file to edit
:prev
E163: There is only one file to edit
:argu
E163: There is only one file to edit

When there is one argument, it makes more sense:

vim -u NONE file
:n
E163: There is only one file to edit
:prev
E163: There is only one file to edit
:argu
(no error)

And when there is more than one, E164 and E165 are used instead, and
make sense:

vim -u NONE file1 file2
:prev
E164: Cannot go before first file
:n
:n
E165: Cannot go beyond last file
:argu 0
Zero count
:argu 3
E165: Cannot go beyond last file

Perhaps a new error could be created for the zero-argument case which
says something like "There are no files to edit".

Just a thought, because I got confused by this error today.

Smiles,

Ben.



Ingo Karkat

unread,
Oct 24, 2012, 3:14:30 AM10/24/12
to vim...@googlegroups.com
Even when Vim is launched with no arguments, an empty buffer ("[No Name]"
representing a (so far unnamed) file is created. I guess this is meant by the
"There is only one file". When you consider buffers that have not yet been
persisted to disk as files, too, it all hopefully makes sense.

-- regards, ingo

Ben Schmidt

unread,
Oct 24, 2012, 10:58:10 PM10/24/12
to vim...@googlegroups.com, Ingo Karkat
No, it doesn't seem that this is the case. See above: When a single
argument is given :argu (or :argu 1) succeeds. When no argument is given
:argu fails. Also, the output of :args is different (not shown above).
That makes sense. When there is a single argument, you can go to it, and
view it. When there isn't, you can't. Only the error messages don't make
sense when there are no arguments.

(N.B. whether or not the arguments represent existing or non-existing
files is irrelevant.)

A clearer way to see the difference:

vim -u NONE
:append
some text
.
:set hidden
:new
:only
:argu
E163: There is only one file to edit
:buf 1

vim -u NONE something
:append
some text
.
:set hidden
:new
:only
:argu
(brings back the buffer for 'something', containing 'some text')

Ben.



Bram Moolenaar

unread,
Oct 25, 2012, 12:17:12 AM10/25/12
to Ben Schmidt, vim-dev
Since quite a few users confuse buffers and files, perhaps "the argument
list is empty"?

--
Bad fashion can discourage normal people from interacting with the engineer
and talking about the cute things their children do.
(Scott Adams - The Dilbert principle)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Ben Schmidt

unread,
Oct 25, 2012, 8:32:08 AM10/25/12
to vim...@googlegroups.com, Bram Moolenaar
Yeah, that sounds good to me.

Ben.



Reply all
Reply to author
Forward
0 new messages