On 24/10/12 6:14 PM, Ingo Karkat wrote:
On 24-Oct-2012 02:25:58 +0200, Ben Schmidt wrote:
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.
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.
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.
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php