[vim/vim] Confusing error message (#2523)

18 views
Skip to first unread message

glacambre

unread,
Jan 3, 2018, 6:29:50 AM1/3/18
to vim/vim, Subscribed

When using VIM version Gentoo-8.0.1298, running

:win_getid()

Will show the following error: E465: :winsize requires two number arguments. I expected a message saying either Not an editor command: win_getid() or :win_getid requires two number arguments to be displayed. I don't know if these messages make sense since I know nothing about how :win_getid() works but :winsize requires two number arguments doesn't seem very helpful to me since I didn't try calling :winsize.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

Christian Brabandt

unread,
Jan 3, 2018, 6:33:05 AM1/3/18
to vim/vim, Subscribed

agreed, the error message can be better. Note however you are talking about a function and functions need to be called, e.g. :call win_getid() or if you want to see the result: :echo win_getid()

lacygoill

unread,
Feb 5, 2021, 7:23:54 PM2/5/21
to vim/vim, Subscribed

This happens because win_getid() is parsed as an abbreviated form of the Ex command :winsize, which here is :win, and the argument _getid(). But _getid() is not a number, and even if it was, :winsize needs 2 numbers.

In Vim9, such a confusing error would not occur for 2 reasons:

  • :call is no longer needed to call a function
  • whitespace is enforced between an Ex command name and its argument; which gives the extra benefit of making the code more readable


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

lacygoill

unread,
Feb 5, 2021, 11:24:41 PM2/5/21
to vim/vim, Subscribed

In Vim9, such a confusing error would not occur for 2 reasons:

Which is why I hope at some point we'll have a 'vim9cmdline' option to let us use all the Vim9 syntaxes on the command-line. Sometimes, while developing a plugin, we need to execute a few commands on the command-line; if we're writing a plugin in Vim9 stript, it's confusing to have to use a legacy syntax.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Feb 6, 2021, 6:59:02 AM2/6/21
to vim/vim, Subscribed

Closed #2523 via f5a5116.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Feb 6, 2021, 7:33:15 AM2/6/21
to vim...@googlegroups.com, lacygoill

> > In Vim9, such a confusing error would not occur for 2 reasons:
>
> Which is why I hope at some point we'll have a 'vim9cmdline' option to
> let us use all the Vim9 syntaxes on the command-line. Sometimes,
> while developing a plugin, we need to execute a few commands on the
> command-line; if we're writing a plugin in Vim9 stript, it's confusing
> to have to use a legacy syntax.

We could use ":vim9" as a command modifier. Although it might be
confusing to use the same at script level as with a command modifier.
Using "vim9cmd" and "vim9script" works, and we could use "vim9" as the
short form of "vim9cmd", since it's not so bad putting "vim9script" at
the top of a script, you only type it once.

Shorter forms such as "v9" and "vi9" don't work, these match existing
commands and they would be used in legacy script context.

--
FATHER: Who are you?
PRINCE: I'm ... your son ...
FATHER: Not you.
LAUNCELOT: I'm ... er ... Sir Launcelot, sir.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// 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 ///
Reply all
Reply to author
Forward
0 new messages