When get_body() (ref-source-attr-get_body()) is called from <Plug>(ref-keyword) (ref#K) and throws an exception with an error message, the error message is not displayed. Instead, keywordprg is called. This is because we always fall back to K when any exception is caught.
Solution
Fall back to K ONLY when source is not found, and display any other exception as an error message. This way, exception thrown by get_body() will always be displayed.
I changed the behavior of
<Plug>(ref-keyword)
a little. This patch consists of two commits. The details are as follows.1. https://github.com/thinca/vim-ref/commit/8c282e3c172debe24060808d1ebc68ef99288729
Problem
When
get_body()
(ref-source-attr-get_body()
) is called from<Plug>(ref-keyword)
(ref#K
) and throws an exception with an error message, the error message is not displayed. Instead,keywordprg
is called. This is because we always fall back toK
when any exception is caught.Solution
Fall back to
K
ONLY when source is not found, and display any other exception as an error message. This way, exception thrown byget_body()
will always be displayed.2. https://github.com/thinca/vim-ref/pull/65/commits/1777190eff396b9e38d26d3bffecf49c07132009
Problem
Cannot display error message such as
E349: No identifier under cursor
.Solution
Catch an exception thrown by
get_keyword()
(ref-source-attr-get_keyword()
) and display it as an error message. This will work in combination with the previous commit (https://github.com/thinca/vim-ref/commit/8c282e3c172debe24060808d1ebc68ef99288729).