如何找出 Vim 错误代码的含义?

问题描述 投票:0回答:2

Vim 处理错误或异常的方式是给出类似

E107
的错误代码以及类似
Unknown function: a
的消息。要找出有关错误代码的详细信息,我可以使用
:h E107
或触发错误以查看会发生什么。

但是,某些错误代码对我来说仍然不透明,因为文档只是列出它们而不是给出描述。例如,

E107
的文档中也列出了代码
E117
,但没有明确说明其含义。更糟糕的是,
:h E107
显示该错误代码没有单独的文档。

以下是相关文件。由于该段落多次提到

range
,我猜
E117
就是做
range

                                          :cal :call E107 E117
:[range]cal[l] {name}([arguments])
        Call a function.  The name of the function and its arguments
        are as specified with |:function|.  Up to 20 arguments can be
        used.  The returned value is discarded.
        Without a range and for functions that accept a range, the
        function is called once.  When a range is given the cursor is
        positioned at the start of the first line before executing the
        function.
        When a range is given and the function doesn't handle it
        itself, the function is executed for each line in the range,
        with the cursor in the first column of that line.  The cursor
        is left at the last line (possibly moved by the last function
        call).

由于我对 vim 可能产生的错误还很陌生,所以我所能做的就是猜测。一般来说,有没有更好的方法可以弄清楚 Vim 错误代码的含义?非常感谢。

vim error-code
2个回答
2
投票

不,不幸的是没有更好的方法,而且我也不知道众包资源。尽管那将是一个有趣的周末项目。


0
投票

Vim

errors.h
目录中的
src
文件 [1] 包含错误号和相应错误消息的列表。为了解决您的示例,在这里您将看到
E107
对应于
Missing parentheses: ...
E117
对应于
Unknown function: ...

[1] https://github.com/vim/vim/blob/master/src/errors.h

© www.soinside.com 2019 - 2024. All rights reserved.